Skip to content

NIFI-14808 Introduce MockParameterLookup class for parameters passing#10159

Merged
exceptionfactory merged 1 commit intoapache:mainfrom
kubaugust:NIFI-14808
Aug 1, 2025
Merged

NIFI-14808 Introduce MockParameterLookup class for parameters passing#10159
exceptionfactory merged 1 commit intoapache:mainfrom
kubaugust:NIFI-14808

Conversation

@kubaugust
Copy link
Contributor

@kubaugust kubaugust commented Aug 1, 2025

Summary

NIFI-14808

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 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 mvn clean install -P contrib-check
    • JDK 21

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

@kubaugust kubaugust changed the title Introduce MockParameterLookup class for parameters passing NIFI-14808 Introduce MockParameterLookup class for parameters passing Aug 1, 2025
@kubaugust kubaugust force-pushed the NIFI-14808 branch 3 times, most recently from 0d5cd6a to db7c5cb Compare August 1, 2025 10:37
@kubaugust kubaugust marked this pull request as ready for review August 1, 2025 11:18
Copy link

@sfc-gh-dhandermann sfc-gh-dhandermann left a comment

Choose a reason for hiding this comment

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

Thanks for proposing this improvement @kubaugust. Most of the changes look straightforward. The only concern I noted is the ambiguity of the two-argument constructor. Although the MockValidationContext has minimal direct use in the project, it could also be used outside, and requiring the disambiguation is not optimal for compatibility. Eliminating that and simply supporting the three-argument constructor with the ParameterLookup instance should resolve both issues. That should remove the need to change other classes as well, so those changes can be reverted.

this(processContext, stateManager, ParameterLookup.EMPTY);
}

public MockValidationContext(final MockProcessContext processContext, final Map<String, String> parameters) {

Choose a reason for hiding this comment

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

Although the Map<String, String> of parameters is convenient, it is not necessarily intuitive for all use cases, so I recommend removing this constructor. Removing it also eliminates the need to disambiguate existing usage of null for the StateManager.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks David for noticing! Indeed, this might be a bit unintuitive... Removed this constructor

@kubaugust kubaugust force-pushed the NIFI-14808 branch 2 times, most recently from 51e8436 to d00fd46 Compare August 1, 2025 14:14
Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

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

Thanks for this addition to the nifi-mock library @kubaugust, the latest version looks good! +1 merging

@exceptionfactory exceptionfactory merged commit f5d42c3 into apache:main Aug 1, 2025
11 of 12 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.

3 participants