diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java index 523bc79afe..30f663ad4e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java @@ -1132,6 +1132,8 @@ public class StandardVersionedComponentSynchronizer implements VersionedComponen destination.addControllerService(newService); } + updateControllerService(newService, proposed); + return newService; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizerTest.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizerTest.java index d56c63d443..96445ab437 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizerTest.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizerTest.java @@ -132,6 +132,8 @@ public class StandardVersionedComponentSynchronizerTest { private ParameterContextManager parameterContextManager; private ParameterReferenceManager parameterReferenceManager; private CapturingScheduledStateChangeListener scheduledStateChangeListener; + private ControllerServiceNode controllerServiceNode; + private BundleCoordinate bundleCoordinate; private final Set queuesWithData = Collections.synchronizedSet(new HashSet<>()); private final Bundle bundle = new Bundle("group", "artifact", "version 1.0"); @@ -148,8 +150,11 @@ public class StandardVersionedComponentSynchronizerTest { parameterContextManager = new StandardParameterContextManager(); parameterReferenceManager = Mockito.mock(ParameterReferenceManager.class); + bundleCoordinate = new BundleCoordinate("org.apache.nifi", "nifi-standard-nar", "1.18.0"); + controllerServiceNode = Mockito.mock(ControllerServiceNode.class); + when(controllerServiceNode.getBundleCoordinate()).thenReturn(bundleCoordinate); when(flowManager.createControllerService(anyString(), anyString(), any(BundleCoordinate.class), anySet(), anyBoolean(), anyBoolean(), nullable(String.class))) - .thenReturn(Mockito.mock(ControllerServiceNode.class)); + .thenReturn(controllerServiceNode); when(flowManager.getParameterContextManager()).thenReturn(parameterContextManager); doAnswer(invocation -> { invocation.getArgument(0, Runnable.class).run(); @@ -659,13 +664,13 @@ public class StandardVersionedComponentSynchronizerTest { }); } - @Test public void testAddsControllerService() throws FlowSynchronizationException, InterruptedException, TimeoutException { final VersionedControllerService versionedService = createMinimalVersionedControllerService(); synchronizer.synchronize(null, versionedService, group, synchronizationOptions); verify(group).addControllerService(any(ControllerServiceNode.class)); + verify(controllerServiceNode).setName(eq(versionedService.getName())); } @Test @@ -1124,6 +1129,7 @@ public class StandardVersionedComponentSynchronizerTest { versionedService.setProperties(Collections.singletonMap("abc", "123")); versionedService.setPosition(new Position(0D, 0D)); versionedService.setType("ControllerServiceImpl"); + versionedService.setBundle(new Bundle(bundleCoordinate.getGroup(), bundleCoordinate.getId(), bundleCoordinate.getVersion())); return versionedService; }