mirror of https://github.com/apache/nifi.git
NIFI-10788 Ensure proposed service config is applied when component synchronizer adds a new service (#6640)
This closes #6640
This commit is contained in:
parent
ddfaf16f68
commit
9c21e26e63
|
@ -1132,6 +1132,8 @@ public class StandardVersionedComponentSynchronizer implements VersionedComponen
|
|||
destination.addControllerService(newService);
|
||||
}
|
||||
|
||||
updateControllerService(newService, proposed);
|
||||
|
||||
return newService;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String> 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue