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

rfellows 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 151177477e2 NIFI-15936: Fixing connector flow uri pattern in cluster 
response mer… (#11244)
151177477e2 is described below

commit 151177477e254038fd73d852abb99dd67db2afc1
Author: Matt Gilman <[email protected]>
AuthorDate: Fri May 15 13:36:00 2026 -0400

    NIFI-15936: Fixing connector flow uri pattern in cluster response mer… 
(#11244)
    
    * NIFI-15936: Fixing connector flow uri pattern in cluster response merging.
    
    * NIFI-15936: Address review feedback.
---
 .../endpoints/ConnectorFlowEndpointMerger.java     |  2 +-
 .../endpoints/ConnectorFlowEndpointMergerTest.java | 47 ++++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectorFlowEndpointMerger.java
 
b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectorFlowEndpointMerger.java
index a933ac46960..2442a9c6566 100644
--- 
a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectorFlowEndpointMerger.java
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectorFlowEndpointMerger.java
@@ -28,7 +28,7 @@ import java.util.Set;
 import java.util.regex.Pattern;
 
 public class ConnectorFlowEndpointMerger extends 
AbstractSingleDTOEndpoint<ProcessGroupFlowEntity, ProcessGroupFlowDTO> {
-    public static final Pattern CONNECTOR_FLOW_URI_PATTERN = 
Pattern.compile("/nifi-api/connectors/[a-f0-9\\-]{36}/flow");
+    public static final Pattern CONNECTOR_FLOW_URI_PATTERN = 
Pattern.compile("/nifi-api/connectors/[a-f0-9\\-]{36}/flow/process-groups/[a-f0-9\\-]{36}");
 
     @Override
     public boolean canHandle(final URI uri, final String method) {
diff --git 
a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectorFlowEndpointMergerTest.java
 
b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectorFlowEndpointMergerTest.java
new file mode 100644
index 00000000000..a34455795f8
--- /dev/null
+++ 
b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/coordination/http/endpoints/ConnectorFlowEndpointMergerTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.cluster.coordination.http.endpoints;
+
+import org.junit.jupiter.api.Test;
+
+import java.net.URI;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class ConnectorFlowEndpointMergerTest {
+
+    @Test
+    public void testCanHandle() {
+        final ConnectorFlowEndpointMerger merger = new 
ConnectorFlowEndpointMerger();
+        final String connectorId = "12345678-1234-1234-1234-123456789012";
+        final String processGroupId = "abcdef01-2345-6789-abcd-ef0123456789";
+        final String connectorFlowUri = "/nifi-api/connectors/" + connectorId 
+ "/flow/process-groups/" + processGroupId;
+
+        // Test valid URIs
+        assertTrue(merger.canHandle(URI.create(connectorFlowUri), "GET"));
+        assertTrue(merger.canHandle(URI.create(connectorFlowUri + 
"?uiOnly=true"), "GET"));
+
+        // Test invalid URIs
+        assertFalse(merger.canHandle(URI.create(connectorFlowUri), "POST"));
+        assertFalse(merger.canHandle(URI.create("/nifi-api/connectors/" + 
connectorId + "/flow"), "GET"));
+        assertFalse(merger.canHandle(URI.create(connectorFlowUri + 
"/controller-services"), "GET"));
+        
assertFalse(merger.canHandle(URI.create("/nifi-api/flow/process-groups/" + 
processGroupId), "GET"));
+        
assertFalse(merger.canHandle(URI.create("/nifi-api/connectors/not-a-uuid/flow/process-groups/"
 + processGroupId), "GET"));
+        assertFalse(merger.canHandle(URI.create("/nifi-api/connectors/" + 
connectorId + "/flow/process-groups/not-a-uuid"), "GET"));
+    }
+}

Reply via email to