Github user bbende commented on a diff in the pull request: https://github.com/apache/nifi/pull/3041#discussion_r222376374 --- Diff: nifi-nar-bundles/nifi-solr-bundle/nifi-solr-processors/src/main/java/org/apache/nifi/processors/solr/SolrProcessor.java --- @@ -176,70 +172,11 @@ protected final KeytabUser getKerberosKeytabUser() { final protected Collection<ValidationResult> customValidate(ValidationContext context) { final List<ValidationResult> problems = new ArrayList<>(); - if (SOLR_TYPE_CLOUD.equals(context.getProperty(SOLR_TYPE).getValue())) { - final String collection = context.getProperty(COLLECTION).getValue(); - if (collection == null || collection.trim().isEmpty()) { - problems.add(new ValidationResult.Builder() - .subject(COLLECTION.getName()) - .input(collection).valid(false) - .explanation("A collection must specified for Solr Type of Cloud") - .build()); - } - } - - // For solr cloud the location will be the ZooKeeper host:port so we can't validate the SSLContext, but for standard solr - // we can validate if the url starts with https we need an SSLContextService, if it starts with http we can't have an SSLContextService - if (SOLR_TYPE_STANDARD.equals(context.getProperty(SOLR_TYPE).getValue())) { - final String solrLocation = context.getProperty(SOLR_LOCATION).evaluateAttributeExpressions().getValue(); - if (solrLocation != null) { - final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); - if (solrLocation.startsWith("https:") && sslContextService == null) { - problems.add(new ValidationResult.Builder() - .subject(SSL_CONTEXT_SERVICE.getDisplayName()) - .valid(false) - .explanation("an SSLContextService must be provided when using https") - .build()); - } else if (solrLocation.startsWith("http:") && sslContextService != null) { - problems.add(new ValidationResult.Builder() - .subject(SSL_CONTEXT_SERVICE.getDisplayName()) - .valid(false) - .explanation("an SSLContextService can not be provided when using http") - .build()); - } - } - } - - // Validate that we username and password are provided together, or that neither are provided - final String username = context.getProperty(BASIC_USERNAME).evaluateAttributeExpressions().getValue(); - final String password = context.getProperty(BASIC_PASSWORD).evaluateAttributeExpressions().getValue(); - - final boolean basicUsernameProvided = !StringUtils.isBlank(username); - final boolean basicPasswordProvided = !StringUtils.isBlank(password); - - if (basicUsernameProvided && !basicPasswordProvided) { - problems.add(new ValidationResult.Builder() - .subject(BASIC_PASSWORD.getDisplayName()) - .valid(false) - .explanation("a password must be provided for the given username") - .build()); - } - - if (basicPasswordProvided && !basicUsernameProvided) { - problems.add(new ValidationResult.Builder() - .subject(BASIC_USERNAME.getDisplayName()) - .valid(false) - .explanation("a username must be provided for the given password") - .build()); - } - - // Validate that only kerberos or basic auth can be set, but not both - final KerberosCredentialsService kerberosCredentialsService = context.getProperty(KERBEROS_CREDENTIALS_SERVICE).asControllerService(KerberosCredentialsService.class); - if (kerberosCredentialsService != null && basicUsernameProvided && basicPasswordProvided) { - problems.add(new ValidationResult.Builder() - .subject(KERBEROS_CREDENTIALS_SERVICE.getDisplayName()) - .valid(false) - .explanation("basic auth and kerberos cannot be configured at the same time") - .build()); + List<ValidationResult> _temp = new ArrayList<>(validateConnectionDetails(context)); + if (_temp.size() == 0 && context.getProperty(CLIENT_SERVICE).isSet()) { --- End diff -- The onScheduled method looks like it hasn't been changed and is not checking to see if a client service is present, and is still creating its own client. We will also need to update the onStopped method to only close the client when it didn't come from the service.
---