You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mt...@apache.org on 2021/12/17 01:09:39 UTC

[nifi] branch main updated: NIFI-9461: Allowing Parameter descriptions to be changed (#5603)

This is an automated email from the ASF dual-hosted git repository.

mtien pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 7d8f99a  NIFI-9461: Allowing Parameter descriptions to be changed (#5603)
7d8f99a is described below

commit 7d8f99a1f41bb1806706c5db857f109c5d7b4e7f
Author: Joe Gresock <jg...@gmail.com>
AuthorDate: Thu Dec 16 20:09:26 2021 -0500

    NIFI-9461: Allowing Parameter descriptions to be changed (#5603)
    
    Merged #5603 into main.
---
 .../apache/nifi/parameter/StandardParameterContext.java  |  3 ++-
 .../nifi/parameter/TestStandardParameterContext.java     | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/parameter/StandardParameterContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/parameter/StandardParameterContext.java
index 51e5664..d17d31f 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/parameter/StandardParameterContext.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/parameter/StandardParameterContext.java
@@ -545,7 +545,8 @@ public class StandardParameterContext implements ParameterContext {
             final Parameter proposedParameter = entry.getValue();
             if (currentEffectiveParameters.containsKey(proposedParameterDescriptor)) {
                 final Parameter currentParameter = currentEffectiveParameters.get(proposedParameterDescriptor);
-                if (!currentParameter.equals(proposedParameter) || currentParameter.getDescriptor().isSensitive() != proposedParameter.getDescriptor().isSensitive()) {
+                if (!currentParameter.equals(proposedParameter) || currentParameter.getDescriptor().isSensitive() != proposedParameter.getDescriptor().isSensitive()
+                        || currentParameter.getDescriptor().getDescription() != proposedParameter.getDescriptor().getDescription()) {
                     // The parameter has been updated in some way
                     effectiveParameterUpdates.put(proposedParameterDescriptor.getName(), proposedParameter);
                 }
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterContext.java
index 8bc2c11..4ad1650 100644
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterContext.java
+++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/test/java/org/apache/nifi/parameter/TestStandardParameterContext.java
@@ -132,6 +132,22 @@ public class TestStandardParameterContext {
     }
 
     @Test
+    public void testChangeDescription() {
+        final ParameterReferenceManager referenceManager = new HashMapParameterReferenceManager();
+        final StandardParameterContext context = new StandardParameterContext("unit-test-context", "unit-test-context", referenceManager, null);
+        final ParameterDescriptor xyzDescriptor = new ParameterDescriptor.Builder().name("xyz").build();
+        final Map<String, Parameter> parameters = new HashMap<>();
+        parameters.put("xyz", new Parameter(xyzDescriptor, "123"));
+        context.setParameters(parameters);
+
+        final Map<String, Parameter> updates = new HashMap<>();
+        final ParameterDescriptor xyzDescriptor2 = new ParameterDescriptor.Builder().from(xyzDescriptor).description("changed").build();
+        final Parameter updatedParameter = new Parameter(xyzDescriptor2, "123");
+        updates.put("xyz", updatedParameter);
+        assertEquals(1, context.getEffectiveParameterUpdates(updates, Collections.emptyList()).size());
+    }
+
+    @Test
     public void testChangingSensitivity() {
         // Ensure no changes applied
         final ParameterReferenceManager referenceManager = new HashMapParameterReferenceManager();