Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,9 @@ private static <T> T replaceNull(final T value, final T replacement) {
* Determines whether a property difference is caused by a statically defined property being removed from the component definition.
* When a processor or controller service drops a property (for example, as part of a version upgrade that invokes {@code removeProperty}
* during migration), the reconciled component in NiFi should not report a "local change" so long as the component does not support
* dynamic properties.
* dynamic properties. This applies whether the registry-side value was a literal value (yielding {@link DifferenceType#PROPERTY_REMOVED})
* or a parameter reference (yielding {@link DifferenceType#PROPERTY_PARAMETERIZATION_REMOVED}); both represent the same underlying
* scenario of a property no longer exposed by the component definition.
*
* @param difference the flow difference under evaluation
* @param flowManager the flow manager used to resolve instantiated components
Expand All @@ -597,7 +599,7 @@ private static <T> T replaceNull(final T value, final T replacement) {
*/
public static boolean isStaticPropertyRemoved(final FlowDifference difference, final FlowManager flowManager) {
final DifferenceType differenceType = difference.getDifferenceType();
if (differenceType != DifferenceType.PROPERTY_REMOVED) {
if (differenceType != DifferenceType.PROPERTY_REMOVED && differenceType != DifferenceType.PROPERTY_PARAMETERIZATION_REMOVED) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,17 @@ public void testIsStaticPropertyRemovedFromDefinitionWhenPropertyDropped() {
"Property removed in component definition");

assertTrue(FlowDifferenceFilters.isStaticPropertyRemoved(difference, flowManager));

final FlowDifference parameterizationRemovedDifference = new StandardFlowDifference(
DifferenceType.PROPERTY_PARAMETERIZATION_REMOVED,
localProcessor,
localProcessor,
propertyName,
"#{SomeParam}",
null,
"Property parameterization removed in component definition");

assertTrue(FlowDifferenceFilters.isStaticPropertyRemoved(parameterizationRemovedDifference, flowManager));
}

@Test
Expand All @@ -231,6 +242,17 @@ public void testIsStaticPropertyRemovedFromDefinitionWhenDescriptorStillExists()
"Property still defined");

assertFalse(FlowDifferenceFilters.isStaticPropertyRemoved(difference, flowManager));

final FlowDifference parameterizationRemovedDifference = new StandardFlowDifference(
DifferenceType.PROPERTY_PARAMETERIZATION_REMOVED,
localProcessor,
localProcessor,
propertyName,
"#{SomeParam}",
null,
"Parameterization removed but property still defined");

assertFalse(FlowDifferenceFilters.isStaticPropertyRemoved(parameterizationRemovedDifference, flowManager));
}

@Test
Expand All @@ -255,6 +277,16 @@ public void testIsStaticPropertyRemovedFromDefinitionWhenDynamicSupported() {
null,
"Dynamic property removed");
assertFalse(FlowDifferenceFilters.isStaticPropertyRemoved(difference, flowManager));

final FlowDifference parameterizationRemovedDifference = new StandardFlowDifference(
DifferenceType.PROPERTY_PARAMETERIZATION_REMOVED,
localProcessor,
localProcessor,
propertyName,
"#{SomeParam}",
null,
"Dynamic property parameterization removed");
assertFalse(FlowDifferenceFilters.isStaticPropertyRemoved(parameterizationRemovedDifference, flowManager));
}

@Test
Expand Down
Loading