NIFI-12531 Parameter references are removed after property migration

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #8176.
This commit is contained in:
krisztina-zsihovszki 2023-12-21 12:24:44 +01:00 committed by Pierre Villard
parent 76f880588f
commit 1a34208f65
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
6 changed files with 20 additions and 4 deletions

View File

@ -2110,7 +2110,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
final List<ControllerServiceCreationDetails> servicesCreated = propertyConfig.getCreatedServices();
servicesCreated.forEach(serviceFactory::create);
overwriteProperties(propertyConfig.getProperties());
overwriteProperties(propertyConfig.getRawProperties());
}
}

View File

@ -452,7 +452,7 @@ public abstract class AbstractReportingTaskNode extends AbstractComponentNode im
final List<ControllerServiceCreationDetails> servicesCreated = propertyConfig.getCreatedServices();
servicesCreated.forEach(serviceFactory::create);
overwriteProperties(propertyConfig.getProperties());
overwriteProperties(propertyConfig.getRawProperties());
}
}

View File

@ -858,7 +858,7 @@ public class StandardControllerServiceNode extends AbstractComponentNode impleme
final List<ControllerServiceCreationDetails> servicesCreated = propertyConfig.getCreatedServices();
servicesCreated.forEach(serviceFactory::create);
overwriteProperties(propertyConfig.getProperties());
overwriteProperties(propertyConfig.getRawProperties());
}
}

View File

@ -57,6 +57,11 @@ public class StandardPropertyConfiguration implements PropertyConfiguration {
return false;
}
if (Objects.equals(propertyName, newName)) {
logger.debug("Will not update property [{}] for [{}] because the new name and the current name are the same", propertyName, componentDescription);
return false;
}
final String effectivePropertyValue = effectiveProperties.remove(propertyName);
effectiveProperties.put(newName, effectivePropertyValue);

View File

@ -107,6 +107,18 @@ public class TestStandardPropertyConfiguration {
assertEquals(expectedProperties, config.getProperties());
}
@Test
public void testRenamePropertyToSameName() {
assertFalse(config.renameProperty("a", "a"));
assertFalse(config.isModified());
assertTrue(config.hasProperty("a"));
assertTrue(config.isPropertySet("a"));
final Map<String, String> expectedProperties = new HashMap<>(originalProperties);
assertEquals(expectedProperties, config.getProperties());
}
@Test
public void testRenameNullProperty() {
assertTrue(config.renameProperty("c", "X"));

View File

@ -597,7 +597,6 @@ public class InvokeHTTP extends AbstractProcessor {
@Override
public void migrateProperties(final PropertyConfiguration config) {
config.renameProperty("Connection Timeout", SOCKET_CONNECT_TIMEOUT.getName());
config.renameProperty("Read Timeout", SOCKET_READ_TIMEOUT.getName());
config.renameProperty("Remote URL", HTTP_URL.getName());
config.renameProperty("disable-http2", HTTP2_DISABLED.getName());