NIFI-16235 - Support rebasing locally added Controller Services in versioned Process Groups - #11571
NIFI-16235 - Support rebasing locally added Controller Services in versioned Process Groups#11571pvillard31 wants to merge 1 commit into
Conversation
…rsioned Process Groups
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for this addition @pvillard31. The basic approach looks good, I noted a handful of mostly test-related recommendations
| 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()); |
There was a problem hiding this comment.
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())); |
There was a problem hiding this comment.
It looks like Fake Service and some other values in this method should be declared once and reused
| 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"); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Recommend capitalizing Process Group and Controller Service here an elsewhere as needed
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
NIFI-00000NIFI-00000VerifiedstatusPull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
./mvnw clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation