Skip to content

NIFI-16202 Switch Mockito attachment to Java Agent - #11612

Merged
pvillard31 merged 2 commits into
apache:mainfrom
exceptionfactory:NIFI-16202
Sep 2, 2026
Merged

NIFI-16202 Switch Mockito attachment to Java Agent#11612
pvillard31 merged 2 commits into
apache:mainfrom
exceptionfactory:NIFI-16202

Conversation

@exceptionfactory

@exceptionfactory exceptionfactory commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

NIFI-16202 Changes the Mockito attachement strategy to use the explicit Java Agent approach instead of the default self-attachment, which results in warnings when building.

The changes adjust the GitHub build workflow, removing the argLine System Property and instead wiring the SUREFIRE_OPTS environment variable through late property resolution in the Maven Surefire Plugin configuration. Together with a build profile that is activated on the presence of SUREFIRE_OPTS, this approach ensures the wiring of additional Locale-specific environment variables to exercise behavior specific to different languages and regions.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

- Moved argLine configuration from GitHub workflow to Maven properties
Comment thread pom.xml
</excludes>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<!-- Runs Mockito as a Java Agent instead of relying on self-attachment -->
<argLine>@{argLine} ${surefire.opts} -javaagent:"${org.mockito:mockito-core:jar}"</argLine>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also configure the Mockito Java agent for maven-failsafe-plugin? The integration-test workflow still reports Mockito self-attachment warnings for tests run by Failsafe.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pvillard31, I pushed an update adding the configuration for the failsafe-plugin

@pvillard31 pvillard31 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@pvillard31
pvillard31 merged commit eb2a1f3 into apache:main Sep 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants