Skip to content

NIFI-16235 - Support rebasing locally added Controller Services in versioned Process Groups - #11571

Open
pvillard31 wants to merge 1 commit into
apache:mainfrom
pvillard31:NIFI-16235
Open

NIFI-16235 - Support rebasing locally added Controller Services in versioned Process Groups#11571
pvillard31 wants to merge 1 commit into
apache:mainfrom
pvillard31:NIFI-16235

Conversation

@pvillard31

Copy link
Copy Markdown
Contributor

Summary

NIFI-16235 - Support rebasing locally added Controller Services in versioned Process Groups

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

@exceptionfactory exceptionfactory 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 for this addition @pvillard31. The basic approach looks good, I noted a handful of mostly test-related recommendations

Comment on lines +168 to +172
assertEquals("Local Controller Service", insertedService.getName());
assertEquals("org.apache.nifi.services.LocalControllerService", insertedService.getType());
assertEquals("group", insertedService.getBundle().getGroup());
assertEquals("artifact", insertedService.getBundle().getArtifact());
assertEquals("1.0.0", insertedService.getBundle().getVersion());

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.

These values should be declared statically and reused

final ProcessGroupEntity originalGroup = util.createProcessGroup("Original", "root");
final ControllerServiceEntity serviceX = util.createControllerService("FakeControllerService1", originalGroup.getId());
final ProcessorEntity fakeProcessor = util.createProcessor("FakeProcessor", originalGroup.getId());
util.updateProcessorProperties(fakeProcessor, Map.of("Fake Service", serviceX.getId()));

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.

It looks like Fake Service and some other values in this method should be declared once and reused

Comment on lines +171 to +175
final VersionedControllerService versionNService = createControllerService("service-x", "Service X", "root");
final VersionedControllerService localAddedService = createControllerService("service-y", "Service Y", "root");

final VersionedProcessor versionNProcessor = createProcessorWithProperty("proc-a", "ProcessorA", "controller.service", "service-x");
final VersionedProcessor localProcessor = createProcessorWithProperty("proc-a", "ProcessorA", "controller.service", "service-y");

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.

The string values in this method and others could use promotion to static final variables

final VersionedProcessGroup targetSnapshot) {
final VersionedComponent addedComponent = localDifference.getComponentB();
if (!(addedComponent instanceof VersionedControllerService controllerService)) {
final String componentType = addedComponent == null ? "null" : addedComponent.getClass().getSimpleName();

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.

Is the use of "null" as a string for componenType intentional? That seems like an odd default value. If it should be used, recommend declaring it statically as NULL_COMPONENT_TYPE

final VersionedProcessGroup parentGroup = resolveParentGroup(targetSnapshot, parentGroupIdentifier, upstreamDifferences);
if (parentGroup == null) {
return RebaseAnalysis.ClassifiedDifference.unsupported(localDifference, RebaseConflictCode.COMPONENT_NOT_FOUND,
"Parent process group %s for controller service %s not found in target snapshot"

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.

Recommend capitalizing Process Group and Controller Service here an elsewhere as needed

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