Github user JPercivall commented on a diff in the pull request: https://github.com/apache/nifi-minifi/pull/50#discussion_r86619023 --- Diff: minifi-commons/minifi-commons-schema/src/main/java/org/apache/nifi/minifi/commons/schema/ConfigSchema.java --- @@ -101,47 +89,60 @@ public ConfigSchema(Map map, List<String> validationIssues) { addIssuesIfNotNull(contentRepositoryProperties); addIssuesIfNotNull(componentStatusRepositoryProperties); addIssuesIfNotNull(securityProperties); + addIssuesIfNotNull(processGroupSchema); addIssuesIfNotNull(provenanceReportingProperties); addIssuesIfNotNull(provenanceRepositorySchema); - addIssuesIfNotNull(processors); - addIssuesIfNotNull(connections); - addIssuesIfNotNull(remoteProcessingGroups); - Set<String> processorIds = new HashSet<>(); - List<String> processorIdList = processors.stream().map(ProcessorSchema::getId).collect(Collectors.toList()); - processorIds.addAll(processorIdList); + List<ProcessGroupSchema> allProcessGroups = getAllProcessGroups(processGroupSchema); + List<ConnectionSchema> allConnectionSchemas = allProcessGroups.stream().flatMap(p -> p.getConnections().stream()).collect(Collectors.toList()); + List<RemoteProcessingGroupSchema> allRemoteProcessingGroups = allProcessGroups.stream().flatMap(p -> p.getRemoteProcessingGroups().stream()).collect(Collectors.toList()); - checkForDuplicates(this::addValidationIssue, FOUND_THE_FOLLOWING_DUPLICATE_PROCESSOR_IDS, processorIdList); - checkForDuplicates(this::addValidationIssue, FOUND_THE_FOLLOWING_DUPLICATE_CONNECTION_IDS, connections.stream().map(ConnectionSchema::getId).collect(Collectors.toList())); - checkForDuplicates(this::addValidationIssue, FOUND_THE_FOLLOWING_DUPLICATE_REMOTE_PROCESSING_GROUP_NAMES, - remoteProcessingGroups.stream().map(RemoteProcessingGroupSchema::getName).collect(Collectors.toList())); - - Set<String> remoteInputPortIds = new HashSet<>(); - List<String> remoteInputPortIdList = remoteProcessingGroups.stream().filter(r -> r.getInputPorts() != null) + List<String> allProcessorIds = allProcessGroups.stream().flatMap(p -> p.getProcessors().stream()).map(ProcessorSchema::getId).collect(Collectors.toList()); + List<String> allConnectionIds = allConnectionSchemas.stream().map(ConnectionSchema::getId).collect(Collectors.toList()); + List<String> allRemoteProcessingGroupNames = allRemoteProcessingGroups.stream().map(RemoteProcessingGroupSchema::getName).collect(Collectors.toList()); + List<String> allRemoteInputPortIds = allRemoteProcessingGroups.stream().filter(r -> r.getInputPorts() != null) .flatMap(r -> r.getInputPorts().stream()).map(RemoteInputPortSchema::getId).collect(Collectors.toList()); - checkForDuplicates(this::addValidationIssue, FOUND_THE_FOLLOWING_DUPLICATE_REMOTE_INPUT_PORT_IDS, remoteInputPortIdList); - remoteInputPortIds.addAll(remoteInputPortIdList); + List<String> allInputPortIds = allProcessGroups.stream().flatMap(p -> p.getInputPortSchemas().stream()).map(PortSchema::getId).collect(Collectors.toList()); + List<String> allOutputPortIds = allProcessGroups.stream().flatMap(p -> p.getOutputPortSchemas().stream()).map(PortSchema::getId).collect(Collectors.toList()); + + checkForDuplicates(this::addValidationIssue, FOUND_THE_FOLLOWING_DUPLICATE_PROCESSOR_IDS, allProcessorIds); + checkForDuplicates(this::addValidationIssue, FOUND_THE_FOLLOWING_DUPLICATE_CONNECTION_IDS, allConnectionIds); + checkForDuplicates(this::addValidationIssue, FOUND_THE_FOLLOWING_DUPLICATE_REMOTE_PROCESSING_GROUP_NAMES, allRemoteProcessingGroupNames); + checkForDuplicates(this::addValidationIssue, FOUND_THE_FOLLOWING_DUPLICATE_REMOTE_INPUT_PORT_IDS, allRemoteInputPortIds); - Set<String> duplicateIds = new HashSet<>(processorIds); - duplicateIds.retainAll(remoteInputPortIds); - if (duplicateIds.size() > 0) { - addValidationIssue(FOUND_THE_FOLLOWING_DUPLICATE_IDS + duplicateIds.stream().sorted().collect(Collectors.joining(", "))); + OverlapResults<String> overlapResults = findOverlap(new HashSet<>(allProcessorIds), new HashSet<>(allRemoteInputPortIds), new HashSet<>(allInputPortIds), new HashSet<>(allOutputPortIds)); + if (overlapResults.duplicates.size() > 0) { + addValidationIssue(FOUND_THE_FOLLOWING_DUPLICATE_IDS + overlapResults.duplicates.stream().sorted().collect(Collectors.joining(", "))); } - Set<String> connectableIds = new HashSet<>(processorIds); - connectableIds.addAll(remoteInputPortIds); - connections.forEach(c -> { + allConnectionSchemas.forEach(c -> { --- End diff -- This block checks if the connections go to any component in any process group. I'm guessing that's due to connections getting routed to Input/Output ports?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---