@Test public void testValidateProperties() { Map<String, String> additionalProperties = new HashMap<>(); additionalProperties.put(NiFiProperties.REMOTE_INPUT_HOST, "localhost"); NiFiProperties properties = loadNiFiProperties("/NiFiProperties/conf/nifi.blank.properties", additionalProperties); try { properties.validate(); } catch (Throwable t) { Assert.fail("unexpected exception: " + t.getMessage()); } additionalProperties.put(NiFiProperties.REMOTE_INPUT_HOST, ""); properties = loadNiFiProperties("/NiFiProperties/conf/nifi.blank.properties", additionalProperties); try { properties.validate(); } catch (Throwable t) { Assert.fail("unexpected exception: " + t.getMessage()); } additionalProperties.remove(NiFiProperties.REMOTE_INPUT_HOST); properties = loadNiFiProperties("/NiFiProperties/conf/nifi.blank.properties", additionalProperties); try { properties.validate(); } catch (Throwable t) { Assert.fail("unexpected exception: " + t.getMessage()); } additionalProperties = new HashMap<>(); additionalProperties.put(NiFiProperties.REMOTE_INPUT_HOST, "http: properties = loadNiFiProperties("/NiFiProperties/conf/nifi.blank.properties", additionalProperties); try { properties.validate(); Assert.fail("Validation should throw an exception"); } catch (Throwable t) { } }
public void validate() { String remoteInputHost = getProperty(REMOTE_INPUT_HOST); if(!StringUtils.isBlank(remoteInputHost) && remoteInputHost.split(":").length > 1) { throw new IllegalArgumentException(remoteInputHost + " is not a correct value for " + REMOTE_INPUT_HOST + ". It should be a valid hostname without protocol or port."); } }
NiFiProperties { public void validate() { String remoteInputHost = getProperty(REMOTE_INPUT_HOST); if(!StringUtils.isBlank(remoteInputHost) && remoteInputHost.split(":").length > 1) { throw new IllegalArgumentException(remoteInputHost + " is not a correct value for " + REMOTE_INPUT_HOST + ". It should be a valid hostname without protocol or port."); } } }
NiFiProperties { public void validate() { String remoteInputHost = getProperty(REMOTE_INPUT_HOST); if(!StringUtils.isBlank(remoteInputHost) && remoteInputHost.split(":").length > 1) { throw new IllegalArgumentException(remoteInputHost + " is not a correct value for " + REMOTE_INPUT_HOST + ". It should be a valid hostname without protocol or port."); } }  }
NiFiProperties { public void validate() { String remoteInputHost = getProperty(REMOTE_INPUT_HOST); if(!StringUtils.isBlank(remoteInputHost) && remoteInputHost.split(":").length > 1) { throw new IllegalArgumentException(remoteInputHost + " is not a correct value for " + REMOTE_INPUT_HOST + ". It should be a valid hostname without protocol or port."); } }  abstract String getProperty(String key); abstract Set<String> getPropertyKeys(); File getFlowConfigurationFile(); File getFlowConfigurationFileDir(); int getQueueSwapThreshold(); Integer getIntegerProperty(final String propertyName, final Integer defaultValue); int getSwapInThreads(); int getSwapOutThreads(); String getSwapInPeriod(); String getSwapOutPeriod(); String getAdministrativeYieldDuration(); String getRemoteInputHost(); Integer getRemoteInputPort(); Boolean isSiteToSiteSecure(); Boolean isSiteToSiteHttpEnabled(); Integer getRemoteInputHttpPort(); Path getTemplateDirectory(); String getFlowServiceWriteDelay(); boolean getAutoResumeState(); int getFlowFileRepositoryPartitions(); String getFlowFileRepositoryCheckpointInterval(); File getRestoreDirectory(); File getAuthorizerConfigurationFile(); File getLoginIdentityProviderConfigurationFile(); boolean getNeedClientAuth(); Integer getPort(); Integer getSslPort(); int getWebThreads(); File getWebWorkingDirectory(); File getComponentDocumentationWorkingDirectory(); File getNarWorkingDirectory(); File getFrameworkWorkingDirectory(); File getExtensionsWorkingDirectory(); List<Path> getNarLibraryDirectories(); String getUiTitle(); String getBannerText(); String getAutoRefreshInterval(); String getClusterProtocolHeartbeatInterval(); String getNodeHeartbeatInterval(); String getClusterNodeReadTimeout(); String getClusterNodeConnectionTimeout(); File getPersistentStateDirectory(); boolean isNode(); InetSocketAddress getClusterNodeProtocolAddress(); Integer getClusterNodeProtocolPort(); int getClusterNodeProtocolThreads(); boolean isClustered(); File getClusterNodeFirewallFile(); String getClusterProtocolManagerToNodeApiScheme(); File getKerberosConfigurationFile(); String getKerberosServicePrincipal(); String getKerberosServiceKeytabLocation(); String getKerberosSpnegoPrincipal(); String getKerberosSpnegoKeytabLocation(); String getKerberosAuthenticationExpiration(); boolean isKerberosSpnegoSupportEnabled(); boolean isClientAuthRequiredForRestApi(); InetSocketAddress getNodeApiAddress(); Path getDatabaseRepositoryPath(); Path getFlowFileRepositoryPath(); Map<String, Path> getContentRepositoryPaths(); Map<String, Path> getProvenanceRepositoryPaths(); int getMaxFlowFilesPerClaim(); String getMaxAppendableClaimSize(); String getProperty(final String key, final String defaultValue); String getBoredYieldDuration(); File getStateManagementConfigFile(); String getLocalStateProviderId(); String getClusterStateProviderId(); File getEmbeddedZooKeeperPropertiesFile(); boolean isStartEmbeddedZooKeeper(); boolean isFlowConfigurationArchiveEnabled(); String getFlowConfigurationArchiveDir(); String getFlowElectionMaxWaitTime(); Integer getFlowElectionMaxCandidates(); String getFlowConfigurationArchiveMaxTime(); String getFlowConfigurationArchiveMaxStorage(); Integer getFlowConfigurationArchiveMaxCount(); String getVariableRegistryProperties(); Path[] getVariableRegistryPropertiesPaths(); Date getBuildTimestamp(); Map<String, String> getHttpNetworkInterfaces(); Map<String, String> getHttpsNetworkInterfaces(); int size(); static NiFiProperties createBasicNiFiProperties(final String propertiesFilePath, final Map<String, String> additionalProperties); void validate(); }
NiFiProperties { public void validate() { String remoteInputHost = getProperty(REMOTE_INPUT_HOST); if(!StringUtils.isBlank(remoteInputHost) && remoteInputHost.split(":").length > 1) { throw new IllegalArgumentException(remoteInputHost + " is not a correct value for " + REMOTE_INPUT_HOST + ". It should be a valid hostname without protocol or port."); } }  abstract String getProperty(String key); abstract Set<String> getPropertyKeys(); File getFlowConfigurationFile(); File getFlowConfigurationFileDir(); int getQueueSwapThreshold(); Integer getIntegerProperty(final String propertyName, final Integer defaultValue); int getSwapInThreads(); int getSwapOutThreads(); String getSwapInPeriod(); String getSwapOutPeriod(); String getAdministrativeYieldDuration(); String getRemoteInputHost(); Integer getRemoteInputPort(); Boolean isSiteToSiteSecure(); Boolean isSiteToSiteHttpEnabled(); Integer getRemoteInputHttpPort(); Path getTemplateDirectory(); String getFlowServiceWriteDelay(); boolean getAutoResumeState(); int getFlowFileRepositoryPartitions(); String getFlowFileRepositoryCheckpointInterval(); File getRestoreDirectory(); File getAuthorizerConfigurationFile(); File getLoginIdentityProviderConfigurationFile(); boolean getNeedClientAuth(); Integer getPort(); Integer getSslPort(); int getWebThreads(); File getWebWorkingDirectory(); File getComponentDocumentationWorkingDirectory(); File getNarWorkingDirectory(); File getFrameworkWorkingDirectory(); File getExtensionsWorkingDirectory(); List<Path> getNarLibraryDirectories(); String getUiTitle(); String getBannerText(); String getAutoRefreshInterval(); String getClusterProtocolHeartbeatInterval(); String getNodeHeartbeatInterval(); String getClusterNodeReadTimeout(); String getClusterNodeConnectionTimeout(); File getPersistentStateDirectory(); boolean isNode(); InetSocketAddress getClusterNodeProtocolAddress(); Integer getClusterNodeProtocolPort(); int getClusterNodeProtocolThreads(); boolean isClustered(); File getClusterNodeFirewallFile(); String getClusterProtocolManagerToNodeApiScheme(); File getKerberosConfigurationFile(); String getKerberosServicePrincipal(); String getKerberosServiceKeytabLocation(); String getKerberosSpnegoPrincipal(); String getKerberosSpnegoKeytabLocation(); String getKerberosAuthenticationExpiration(); boolean isKerberosSpnegoSupportEnabled(); boolean isClientAuthRequiredForRestApi(); InetSocketAddress getNodeApiAddress(); Path getDatabaseRepositoryPath(); Path getFlowFileRepositoryPath(); Map<String, Path> getContentRepositoryPaths(); Map<String, Path> getProvenanceRepositoryPaths(); int getMaxFlowFilesPerClaim(); String getMaxAppendableClaimSize(); String getProperty(final String key, final String defaultValue); String getBoredYieldDuration(); File getStateManagementConfigFile(); String getLocalStateProviderId(); String getClusterStateProviderId(); File getEmbeddedZooKeeperPropertiesFile(); boolean isStartEmbeddedZooKeeper(); boolean isFlowConfigurationArchiveEnabled(); String getFlowConfigurationArchiveDir(); String getFlowElectionMaxWaitTime(); Integer getFlowElectionMaxCandidates(); String getFlowConfigurationArchiveMaxTime(); String getFlowConfigurationArchiveMaxStorage(); Integer getFlowConfigurationArchiveMaxCount(); String getVariableRegistryProperties(); Path[] getVariableRegistryPropertiesPaths(); Date getBuildTimestamp(); Map<String, String> getHttpNetworkInterfaces(); Map<String, String> getHttpsNetworkInterfaces(); int size(); static NiFiProperties createBasicNiFiProperties(final String propertiesFilePath, final Map<String, String> additionalProperties); void validate(); static final String PROPERTIES_FILE_PATH; static final String FLOW_CONFIGURATION_FILE; static final String FLOW_CONFIGURATION_ARCHIVE_ENABLED; static final String FLOW_CONFIGURATION_ARCHIVE_DIR; static final String FLOW_CONFIGURATION_ARCHIVE_MAX_TIME; static final String FLOW_CONFIGURATION_ARCHIVE_MAX_STORAGE; static final String FLOW_CONFIGURATION_ARCHIVE_MAX_COUNT; static final String AUTHORIZER_CONFIGURATION_FILE; static final String LOGIN_IDENTITY_PROVIDER_CONFIGURATION_FILE; static final String REPOSITORY_DATABASE_DIRECTORY; static final String RESTORE_DIRECTORY; static final String VERSION; static final String WRITE_DELAY_INTERVAL; static final String AUTO_RESUME_STATE; static final String FLOW_CONTROLLER_GRACEFUL_SHUTDOWN_PERIOD; static final String NAR_LIBRARY_DIRECTORY; static final String NAR_LIBRARY_DIRECTORY_PREFIX; static final String NAR_WORKING_DIRECTORY; static final String COMPONENT_DOCS_DIRECTORY; static final String SENSITIVE_PROPS_KEY; static final String SENSITIVE_PROPS_ALGORITHM; static final String SENSITIVE_PROPS_PROVIDER; static final String H2_URL_APPEND; static final String REMOTE_INPUT_HOST; static final String REMOTE_INPUT_PORT; static final String SITE_TO_SITE_SECURE; static final String SITE_TO_SITE_HTTP_ENABLED; static final String SITE_TO_SITE_HTTP_TRANSACTION_TTL; static final String TEMPLATE_DIRECTORY; static final String ADMINISTRATIVE_YIELD_DURATION; static final String PERSISTENT_STATE_DIRECTORY; static final String BORED_YIELD_DURATION; static final String PROCESSOR_SCHEDULING_TIMEOUT; static final String REPOSITORY_CONTENT_PREFIX; static final String CONTENT_REPOSITORY_IMPLEMENTATION; static final String MAX_APPENDABLE_CLAIM_SIZE; static final String MAX_FLOWFILES_PER_CLAIM; static final String CONTENT_ARCHIVE_MAX_RETENTION_PERIOD; static final String CONTENT_ARCHIVE_MAX_USAGE_PERCENTAGE; static final String CONTENT_ARCHIVE_BACK_PRESSURE_PERCENTAGE; static final String CONTENT_ARCHIVE_ENABLED; static final String CONTENT_ARCHIVE_CLEANUP_FREQUENCY; static final String CONTENT_VIEWER_URL; static final String FLOWFILE_REPOSITORY_IMPLEMENTATION; static final String FLOWFILE_REPOSITORY_ALWAYS_SYNC; static final String FLOWFILE_REPOSITORY_DIRECTORY; static final String FLOWFILE_REPOSITORY_PARTITIONS; static final String FLOWFILE_REPOSITORY_CHECKPOINT_INTERVAL; static final String FLOWFILE_SWAP_MANAGER_IMPLEMENTATION; static final String QUEUE_SWAP_THRESHOLD; static final String SWAP_IN_THREADS; static final String SWAP_IN_PERIOD; static final String SWAP_OUT_THREADS; static final String SWAP_OUT_PERIOD; static final String PROVENANCE_REPO_IMPLEMENTATION_CLASS; static final String PROVENANCE_REPO_DIRECTORY_PREFIX; static final String PROVENANCE_MAX_STORAGE_TIME; static final String PROVENANCE_MAX_STORAGE_SIZE; static final String PROVENANCE_ROLLOVER_TIME; static final String PROVENANCE_ROLLOVER_SIZE; static final String PROVENANCE_QUERY_THREAD_POOL_SIZE; static final String PROVENANCE_INDEX_THREAD_POOL_SIZE; static final String PROVENANCE_COMPRESS_ON_ROLLOVER; static final String PROVENANCE_INDEXED_FIELDS; static final String PROVENANCE_INDEXED_ATTRIBUTES; static final String PROVENANCE_INDEX_SHARD_SIZE; static final String PROVENANCE_JOURNAL_COUNT; static final String COMPONENT_STATUS_REPOSITORY_IMPLEMENTATION; static final String COMPONENT_STATUS_SNAPSHOT_FREQUENCY; static final String NF_SENSITIVE_PROPS_KEY; static final String NF_SENSITIVE_PROPS_ALGORITHM; static final String NF_SENSITIVE_PROPS_PROVIDER; static final String SECURITY_KEYSTORE; static final String SECURITY_KEYSTORE_TYPE; static final String SECURITY_KEYSTORE_PASSWD; static final String SECURITY_KEY_PASSWD; static final String SECURITY_TRUSTSTORE; static final String SECURITY_TRUSTSTORE_TYPE; static final String SECURITY_TRUSTSTORE_PASSWD; static final String SECURITY_NEED_CLIENT_AUTH; static final String SECURITY_USER_AUTHORIZER; static final String SECURITY_USER_LOGIN_IDENTITY_PROVIDER; static final String SECURITY_CLUSTER_AUTHORITY_PROVIDER_PORT; static final String SECURITY_CLUSTER_AUTHORITY_PROVIDER_THREADS; static final String SECURITY_OCSP_RESPONDER_URL; static final String SECURITY_OCSP_RESPONDER_CERTIFICATE; static final String SECURITY_IDENTITY_MAPPING_PATTERN_PREFIX; static final String SECURITY_IDENTITY_MAPPING_VALUE_PREFIX; static final String WEB_WAR_DIR; static final String WEB_HTTP_PORT; static final String WEB_HTTP_PORT_FORWARDING; static final String WEB_HTTP_HOST; static final String WEB_HTTP_NETWORK_INTERFACE_PREFIX; static final String WEB_HTTPS_PORT; static final String WEB_HTTPS_PORT_FORWARDING; static final String WEB_HTTPS_HOST; static final String WEB_HTTPS_NETWORK_INTERFACE_PREFIX; static final String WEB_WORKING_DIR; static final String WEB_THREADS; static final String UI_BANNER_TEXT; static final String UI_AUTO_REFRESH_INTERVAL; static final String CLUSTER_PROTOCOL_HEARTBEAT_INTERVAL; static final String CLUSTER_PROTOCOL_IS_SECURE; static final String CLUSTER_IS_NODE; static final String CLUSTER_NODE_ADDRESS; static final String CLUSTER_NODE_PROTOCOL_PORT; static final String CLUSTER_NODE_PROTOCOL_THREADS; static final String CLUSTER_NODE_CONNECTION_TIMEOUT; static final String CLUSTER_NODE_READ_TIMEOUT; static final String CLUSTER_FIREWALL_FILE; static final String FLOW_ELECTION_MAX_WAIT_TIME; static final String FLOW_ELECTION_MAX_CANDIDATES; static final String ZOOKEEPER_CONNECT_STRING; static final String ZOOKEEPER_CONNECT_TIMEOUT; static final String ZOOKEEPER_SESSION_TIMEOUT; static final String ZOOKEEPER_ROOT_NODE; static final String KERBEROS_KRB5_FILE; static final String KERBEROS_SERVICE_PRINCIPAL; static final String KERBEROS_SERVICE_KEYTAB_LOCATION; static final String KERBEROS_SPNEGO_PRINCIPAL; static final String KERBEROS_SPNEGO_KEYTAB_LOCATION; static final String KERBEROS_AUTHENTICATION_EXPIRATION; static final String STATE_MANAGEMENT_CONFIG_FILE; static final String STATE_MANAGEMENT_LOCAL_PROVIDER_ID; static final String STATE_MANAGEMENT_CLUSTER_PROVIDER_ID; static final String STATE_MANAGEMENT_START_EMBEDDED_ZOOKEEPER; static final String STATE_MANAGEMENT_ZOOKEEPER_PROPERTIES; static final String VARIABLE_REGISTRY_PROPERTIES; static final String BUILD_TAG; static final String BUILD_BRANCH; static final String BUILD_REVISION; static final String BUILD_TIMESTAMP; static final String DEFAULT_TITLE; static final Boolean DEFAULT_AUTO_RESUME_STATE; static final String DEFAULT_AUTHORIZER_CONFIGURATION_FILE; static final String DEFAULT_LOGIN_IDENTITY_PROVIDER_CONFIGURATION_FILE; static final String DEFAULT_USER_CREDENTIAL_CACHE_DURATION; static final Integer DEFAULT_REMOTE_INPUT_PORT; static final Path DEFAULT_TEMPLATE_DIRECTORY; static final int DEFAULT_WEB_THREADS; static final String DEFAULT_WEB_WORKING_DIR; static final String DEFAULT_NAR_WORKING_DIR; static final String DEFAULT_COMPONENT_DOCS_DIRECTORY; static final String DEFAULT_NAR_LIBRARY_DIR; static final String DEFAULT_FLOWFILE_REPO_PARTITIONS; static final String DEFAULT_FLOWFILE_CHECKPOINT_INTERVAL; static final int DEFAULT_MAX_FLOWFILES_PER_CLAIM; static final int DEFAULT_QUEUE_SWAP_THRESHOLD; static final String DEFAULT_SWAP_STORAGE_LOCATION; static final String DEFAULT_SWAP_IN_PERIOD; static final String DEFAULT_SWAP_OUT_PERIOD; static final int DEFAULT_SWAP_IN_THREADS; static final int DEFAULT_SWAP_OUT_THREADS; static final String DEFAULT_ADMINISTRATIVE_YIELD_DURATION; static final String DEFAULT_PERSISTENT_STATE_DIRECTORY; static final String DEFAULT_COMPONENT_STATUS_SNAPSHOT_FREQUENCY; static final String DEFAULT_BORED_YIELD_DURATION; static final String DEFAULT_ZOOKEEPER_CONNECT_TIMEOUT; static final String DEFAULT_ZOOKEEPER_SESSION_TIMEOUT; static final String DEFAULT_ZOOKEEPER_ROOT_NODE; static final String DEFAULT_SITE_TO_SITE_HTTP_TRANSACTION_TTL; static final String DEFAULT_FLOW_CONFIGURATION_ARCHIVE_ENABLED; static final String DEFAULT_FLOW_CONFIGURATION_ARCHIVE_MAX_TIME; static final String DEFAULT_FLOW_CONFIGURATION_ARCHIVE_MAX_STORAGE; static final String DEFAULT_CLUSTER_PROTOCOL_HEARTBEAT_INTERVAL; static final String DEFAULT_CLUSTER_PROTOCOL_MULTICAST_SERVICE_BROADCAST_DELAY; static final int DEFAULT_CLUSTER_PROTOCOL_MULTICAST_SERVICE_LOCATOR_ATTEMPTS; static final String DEFAULT_CLUSTER_PROTOCOL_MULTICAST_SERVICE_LOCATOR_ATTEMPTS_DELAY; static final String DEFAULT_CLUSTER_NODE_READ_TIMEOUT; static final String DEFAULT_CLUSTER_NODE_CONNECTION_TIMEOUT; static final int DEFAULT_CLUSTER_NODE_PROTOCOL_THREADS; static final String DEFAULT_REQUEST_REPLICATION_CLAIM_TIMEOUT; static final String DEFAULT_FLOW_ELECTION_MAX_WAIT_TIME; static final String DEFAULT_STATE_MANAGEMENT_CONFIG_FILE; static final String DEFAULT_KERBEROS_AUTHENTICATION_EXPIRATION; }