This is an automated email from the ASF dual-hosted git repository.
bbende pushed a commit to branch NIFI-15258
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/NIFI-15258 by this push:
new b1858b412f NIFI-15579: When synchronizing PG when Versioned flow for
stateless group node, do not synchronize parameter contexts if group is within
a Connector (#10884)
b1858b412f is described below
commit b1858b412f082065afb40df2c8bf381d7a4fec10
Author: Mark Payne <[email protected]>
AuthorDate: Thu Feb 12 12:44:18 2026 -0500
NIFI-15579: When synchronizing PG when Versioned flow for stateless group
node, do not synchronize parameter contexts if group is within a Connector
(#10884)
---
.../flow/StandardStatelessGroupNodeFactory.java | 19 ++++++++++++++++++-
.../tests/system/connectors/ConnectorLifecycleIT.java | 13 +++++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardStatelessGroupNodeFactory.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardStatelessGroupNodeFactory.java
index a00fc725a5..2f3f164faf 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardStatelessGroupNodeFactory.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/flow/StandardStatelessGroupNodeFactory.java
@@ -189,10 +189,20 @@ public class StandardStatelessGroupNodeFactory implements
StatelessGroupNodeFact
private VersionedExternalFlow createVersionedExternalFlow(final
ProcessGroup group, final FlowMappingOptions flowMappingOptions) {
final VersionedComponentFlowMapper flowMapper = new
VersionedComponentFlowMapper(flowController.getExtensionManager(),
flowMappingOptions);
final InstantiatedVersionedProcessGroup versionedGroup =
flowMapper.mapNonVersionedProcessGroup(group,
flowController.getControllerServiceProvider());
- final Map<String, VersionedParameterContext> parameterContexts =
flowMapper.mapParameterContexts(group, true, new HashMap<>());
final Map<String, ExternalControllerServiceReference>
externalControllerServiceReferences =
Optional.ofNullable(versionedGroup.getExternalControllerServiceReferences()).orElse(Collections.emptyMap());
+ // If the Process Group is within a Connector, then we do not want to
map Parameter Contexts
+ // because we do not use the standard management for Parameter
Contexts and instead use only an implicit
+ // Parameter Context for the entire Connector.
+ final boolean inConnector = group.getConnectorIdentifier().isPresent();
+ final Map<String, VersionedParameterContext> parameterContexts;
+ if (inConnector) {
+ parameterContexts = Collections.emptyMap();
+ } else {
+ parameterContexts = flowMapper.mapParameterContexts(group, true,
new HashMap<>());
+ }
+
final VersionedExternalFlow versionedExternalFlow = new
VersionedExternalFlow();
versionedExternalFlow.setFlowContents(versionedGroup);
versionedExternalFlow.setExternalControllerServices(externalControllerServiceReferences);
@@ -301,6 +311,13 @@ public class StandardStatelessGroupNodeFactory implements
StatelessGroupNodeFact
child.synchronizeFlow(versionedExternalFlow, synchronizationOptions,
flowMappingOptions);
child.setParent(group);
+ // If this Process Group is within a Connector, explicitly set the
Parameter Context
+ // on the child Process Group to be the same as the parent group
because we want all
+ // groups within a Connector to share the same Parameter Context.
+ if (group.getConnectorIdentifier().isPresent()) {
+ child.setParameterContext(group.getParameterContext());
+ }
+
return child;
}
diff --git
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorLifecycleIT.java
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorLifecycleIT.java
index 5860286bcc..dc1a50de1a 100644
---
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorLifecycleIT.java
+++
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/ConnectorLifecycleIT.java
@@ -26,6 +26,8 @@ import org.apache.nifi.web.api.dto.ProcessGroupDTO;
import org.apache.nifi.web.api.dto.ProcessorDTO;
import org.apache.nifi.web.api.dto.flow.FlowDTO;
import org.apache.nifi.web.api.entity.ConnectorEntity;
+import org.apache.nifi.web.api.entity.ParameterContextEntity;
+import org.apache.nifi.web.api.entity.ParameterContextsEntity;
import org.apache.nifi.web.api.entity.PortEntity;
import org.apache.nifi.web.api.entity.ProcessGroupEntity;
import org.apache.nifi.web.api.entity.ProcessGroupFlowEntity;
@@ -35,7 +37,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
+import java.util.Collections;
+import java.util.Set;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -64,6 +69,14 @@ public class ConnectorLifecycleIT extends NiFiSystemIT {
logger.info("Starting connector {}", connectorId);
getClientUtil().startConnector(connectorId);
+ // Ensure that there are no Parameter Contexts defined. When we start
a flow that has a Stateless Group,
+ // we synchronize the Process Group with the Versioned External Flow,
and we want to ensure that this does
+ // not register a Parameter Context
+ final ParameterContextsEntity contextsEntity =
getNifiClient().getParamContextClient().getParamContexts();
+ final Set<ParameterContextEntity> parameterContexts =
contextsEntity.getParameterContexts();
+ assertNotNull(parameterContexts);
+ assertEquals(Collections.emptySet(), parameterContexts);
+
logger.info("Verifying flow has components after start");
verifyFlowHasComponents(connectorId);