Skip to content

Commit

Permalink
Fixed #379 - Deprecated debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
khmarbaise committed Oct 28, 2023
1 parent b4606cc commit eeb2c89
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
//

[[release-notes-0.12.0]]
== Pre-release 0.12.0

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 #??]

Expand All @@ -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 <<release-0.12.0.breaking-changes, Version 0.12.0>>.
* 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*

Expand Down
40 changes: 29 additions & 11 deletions itf-documentation/src/main/asciidoc/usersguide/usersguide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -808,7 +811,7 @@ annotations to your tests like this:
----
@MavenJupiterExtension
@MavenOption(MavenCLIOptions.ERRORS)
@MavenOption(MavenCLIOptions.DEBUG)
@MavenOption(MavenCLIOptions.VERBOSE)
class BasicIT {
@MavenTest
Expand All @@ -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 {
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,7 +38,7 @@
* @author Karl Heinz Marbaise
*/
@MavenJupiterExtension
@MavenDebug
@MavenVerbose
class LogoutputIT {

@MavenTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat;

@MavenJupiterExtension
@MavenOption(MavenCLIOptions.DEBUG)
@MavenOption(MavenCLIOptions.VERBOSE)
class OptionsOnClassIT {

@MavenTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
Original file line number Diff line number Diff line change
@@ -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}.
*
* <p>When applied at the class level, all test methods within that class
* are automatically inheriting the given goal.</p>
*
* @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 {
}
Loading

0 comments on commit eeb2c89

Please sign in to comment.