NIFI-12387 Initialize Controller Service Comments with Empty String

The empty string allows controller service configuration to be saved without flow
configuration history recording a configuration change for comments.

This closes #8275

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Nissim Shiman 2024-01-19 15:40:06 +00:00 committed by exceptionfactory
parent 693b187396
commit 2e3f83eb54
No known key found for this signature in database
2 changed files with 3 additions and 0 deletions

View File

@ -136,6 +136,7 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme
this.active = new AtomicBoolean(); this.active = new AtomicBoolean();
setControllerServiceAndProxy(implementation, proxiedControllerService, invocationHandler); setControllerServiceAndProxy(implementation, proxiedControllerService, invocationHandler);
stateTransition = new ServiceStateTransition(this); stateTransition = new ServiceStateTransition(this);
this.comment = "";
} }
@Override @Override

View File

@ -860,6 +860,7 @@ public class TestFlowController {
assertEquals(ServiceA.class.getSimpleName(), controllerServiceNode.getComponentType()); assertEquals(ServiceA.class.getSimpleName(), controllerServiceNode.getComponentType());
assertEquals(ServiceA.class.getCanonicalName(), controllerServiceNode.getComponent().getClass().getCanonicalName()); assertEquals(ServiceA.class.getCanonicalName(), controllerServiceNode.getComponent().getClass().getCanonicalName());
assertEquals(LogLevel.WARN, controllerServiceNode.getBulletinLevel()); assertEquals(LogLevel.WARN, controllerServiceNode.getBulletinLevel());
assertEquals("", controllerServiceNode.getComments());
controller.getReloadComponent().reload(controllerServiceNode, ServiceB.class.getName(), coordinate, Collections.emptySet()); controller.getReloadComponent().reload(controllerServiceNode, ServiceB.class.getName(), coordinate, Collections.emptySet());
@ -868,6 +869,7 @@ public class TestFlowController {
assertEquals(id, controllerServiceNode.getComponent().getIdentifier()); assertEquals(id, controllerServiceNode.getComponent().getIdentifier());
assertEquals(coordinate.getCoordinate(), controllerServiceNode.getBundleCoordinate().getCoordinate()); assertEquals(coordinate.getCoordinate(), controllerServiceNode.getBundleCoordinate().getCoordinate());
assertEquals(LogLevel.WARN, controllerServiceNode.getBulletinLevel()); assertEquals(LogLevel.WARN, controllerServiceNode.getBulletinLevel());
assertEquals("", controllerServiceNode.getComments());
// in this test we happened to change between two services that have different canonical class names // in this test we happened to change between two services that have different canonical class names
// but in the running application the DAO layer would call verifyCanUpdateBundle and would prevent this so // but in the running application the DAO layer would call verifyCanUpdateBundle and would prevent this so