You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by br...@apache.org on 2024/01/30 07:25:23 UTC
(nifi) branch main updated: NIFI-12682 Fix MiNiFi agent manifest hash swaps
This is an automated email from the ASF dual-hosted git repository.
briansolo1985 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 13271d198f NIFI-12682 Fix MiNiFi agent manifest hash swaps
13271d198f is described below
commit 13271d198f8d09e5634a0923c1920ded41a84222
Author: Ferenc Erdei <er...@gmail.com>
AuthorDate: Mon Jan 29 13:35:53 2024 +0100
NIFI-12682 Fix MiNiFi agent manifest hash swaps
Signed-off-by: Ferenc Kis <br...@gmail.com>
This closes #8309.
---
.../service/operation/SupportedOperationsProvider.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SupportedOperationsProvider.java b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SupportedOperationsProvider.java
index d60a9fee1a..591c02b1f1 100644
--- a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SupportedOperationsProvider.java
+++ b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/SupportedOperationsProvider.java
@@ -17,7 +17,10 @@
package org.apache.nifi.c2.client.service.operation;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.nifi.c2.protocol.api.OperandType;
@@ -34,17 +37,26 @@ public class SupportedOperationsProvider {
public Set<SupportedOperation> getSupportedOperations() {
return operationHandlers.entrySet()
.stream()
+ .sorted(Map.Entry.comparingByKey())
.map(operationEntry -> getSupportedOperation(operationEntry.getKey(), operationEntry.getValue()))
- .collect(Collectors.toSet());
+ .collect(Collectors.toCollection(LinkedHashSet::new));
}
private SupportedOperation getSupportedOperation(OperationType operationType, Map<OperandType, C2OperationHandler> operands) {
SupportedOperation supportedOperation = new SupportedOperation();
supportedOperation.setType(operationType);
- Map<OperandType, Map<String, Object>> properties = operands.values()
+ Map<OperandType, Map<String, Object>> properties = operands.entrySet()
.stream()
- .collect(Collectors.toMap(C2OperationHandler::getOperandType, C2OperationHandler::getProperties));
+ .sorted(Map.Entry.comparingByKey())
+ .map(Entry::getValue)
+ .collect(
+ Collectors.toMap(
+ C2OperationHandler::getOperandType,
+ C2OperationHandler::getProperties,
+ (existing, replacement) -> existing,
+ LinkedHashMap::new
+ ));
supportedOperation.setProperties(properties);