You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2023/06/16 14:41:53 UTC
[nifi] branch support/nifi-1.x updated (e47d18fed0 -> a71e1c1c16)
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a change to branch support/nifi-1.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
from e47d18fed0 NIFI-11698 Changed GitHub MacOS and Windows timeouts to 150 mins
new 3f4c373a90 NIFI-11710 Corrected nifi-kafka-2-6-nar Description
new a71e1c1c16 NIFI-11699 Fixed dynamic properties in SnowflakeComputingConnectionPool
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../nifi-kafka-bundle/nifi-kafka-2-6-nar/pom.xml | 2 +-
.../processors/snowflake/SnowflakeConfigAware.java | 1 -
.../nifi/processors/snowflake/SnowflakePipeIT.java | 4 ++--
.../nifi-snowflake-services/pom.xml | 9 ++++++++
.../service/SnowflakeComputingConnectionPool.java | 27 +++++++++++++++-------
5 files changed, 31 insertions(+), 12 deletions(-)
[nifi] 01/02: NIFI-11710 Corrected nifi-kafka-2-6-nar Description
Posted by ex...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch support/nifi-1.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit 3f4c373a903ad015d77e534fe798b875a4777916
Author: mr1716 <ms...@rit.edu>
AuthorDate: Fri Jun 16 10:00:46 2023 -0400
NIFI-11710 Corrected nifi-kafka-2-6-nar Description
This closes #7390
Signed-off-by: David Handermann <ex...@apache.org>
(cherry picked from commit 7c7b7c026b612ae10d3d2c6a76bf617e5b36fbf0)
---
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-2-6-nar/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-2-6-nar/pom.xml b/nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-2-6-nar/pom.xml
index 6c5c583547..923ef31078 100644
--- a/nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-2-6-nar/pom.xml
+++ b/nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-2-6-nar/pom.xml
@@ -21,7 +21,7 @@
</parent>
<artifactId>nifi-kafka-2-6-nar</artifactId>
<packaging>nar</packaging>
- <description>NiFi NAR for interacting with Apache Kafka 2.5</description>
+ <description>NiFi NAR for interacting with Apache Kafka 2.6</description>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
<source.skip>true</source.skip>
[nifi] 02/02: NIFI-11699 Fixed dynamic properties in SnowflakeComputingConnectionPool
Posted by ex...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch support/nifi-1.x
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit a71e1c1c165ac5fc4cbdd38fcbbf52cfdc7a8730
Author: Peter Turcsanyi <tu...@apache.org>
AuthorDate: Thu Jun 15 23:12:02 2023 +0200
NIFI-11699 Fixed dynamic properties in SnowflakeComputingConnectionPool
Also fixed driver class name handling (caused IT test failure).
Other test fixes to make IT tests work.
This closes #7387
Signed-off-by: David Handermann <ex...@apache.org>
(cherry picked from commit b36570f2cd2992450d6d36a934cda0d206ca7fc1)
---
.../processors/snowflake/SnowflakeConfigAware.java | 1 -
.../nifi/processors/snowflake/SnowflakePipeIT.java | 4 ++--
.../nifi-snowflake-services/pom.xml | 9 ++++++++
.../service/SnowflakeComputingConnectionPool.java | 27 +++++++++++++++-------
4 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/test/java/org/apache/nifi/processors/snowflake/SnowflakeConfigAware.java b/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/test/java/org/apache/nifi/processors/snowflake/SnowflakeConfigAware.java
index ff7c03a684..2e892835dd 100644
--- a/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/test/java/org/apache/nifi/processors/snowflake/SnowflakeConfigAware.java
+++ b/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/test/java/org/apache/nifi/processors/snowflake/SnowflakeConfigAware.java
@@ -31,7 +31,6 @@ import org.apache.nifi.util.TestRunner;
public interface SnowflakeConfigAware {
Path filePath = Paths.get("???");
- String stagedFilePath = "???";
String organizationName = "???";
String accountName = "???";
diff --git a/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/test/java/org/apache/nifi/processors/snowflake/SnowflakePipeIT.java b/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/test/java/org/apache/nifi/processors/snowflake/SnowflakePipeIT.java
index d895e73f72..225e46fa3f 100644
--- a/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/test/java/org/apache/nifi/processors/snowflake/SnowflakePipeIT.java
+++ b/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/test/java/org/apache/nifi/processors/snowflake/SnowflakePipeIT.java
@@ -85,7 +85,7 @@ class SnowflakePipeIT implements SnowflakeConfigAware {
false);
}
- final Map<String, String> attributes = Collections.singletonMap(SnowflakeAttributes.ATTRIBUTE_STAGED_FILE_PATH, uuid + "/" + stagedFilePath);
+ final Map<String, String> attributes = Collections.singletonMap(SnowflakeAttributes.ATTRIBUTE_STAGED_FILE_PATH, uuid + "/" + fileName);
runner.enqueue("", attributes);
runner.run();
@@ -114,7 +114,7 @@ class SnowflakePipeIT implements SnowflakeConfigAware {
false);
}
- final String stagedFilePathAttribute = uuid + "/" + stagedFilePath;
+ final String stagedFilePathAttribute = uuid + "/" + fileName;
final StagedFileWrapper stagedFile = new StagedFileWrapper(stagedFilePathAttribute);
ingestManagerProviderService.getIngestManager().ingestFile(stagedFile, null);
diff --git a/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/pom.xml b/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/pom.xml
index 06bdf595b1..f3a4d2f129 100644
--- a/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/pom.xml
+++ b/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/pom.xml
@@ -81,5 +81,14 @@
<version>1.23.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.nifi</groupId>
+ <artifactId>nifi-kerberos-user-service-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
</dependencies>
</project>
diff --git a/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java b/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java
index 492d14340f..139e7fb13d 100644
--- a/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java
+++ b/nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java
@@ -21,6 +21,7 @@ import net.snowflake.client.jdbc.SnowflakeDriver;
import org.apache.nifi.annotation.behavior.DynamicProperties;
import org.apache.nifi.annotation.behavior.DynamicProperty;
import org.apache.nifi.annotation.behavior.RequiresInstanceClassLoading;
+import org.apache.nifi.annotation.behavior.SupportsSensitiveDynamicProperties;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.components.PropertyDescriptor;
@@ -30,6 +31,7 @@ import org.apache.nifi.controller.ConfigurationContext;
import org.apache.nifi.dbcp.AbstractDBCPConnectionPool;
import org.apache.nifi.dbcp.utils.DBCPProperties;
import org.apache.nifi.dbcp.utils.DataSourceConfiguration;
+import org.apache.nifi.expression.AttributeExpression;
import org.apache.nifi.expression.ExpressionLanguageScope;
import org.apache.nifi.processor.exception.ProcessException;
import org.apache.nifi.processor.util.StandardValidators;
@@ -49,7 +51,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
-import static org.apache.nifi.dbcp.utils.DBCPProperties.DB_DRIVERNAME;
import static org.apache.nifi.dbcp.utils.DBCPProperties.DB_PASSWORD;
import static org.apache.nifi.dbcp.utils.DBCPProperties.DB_USER;
import static org.apache.nifi.dbcp.utils.DBCPProperties.EVICTION_RUN_PERIOD;
@@ -69,15 +70,12 @@ import static org.apache.nifi.dbcp.utils.DBCPProperties.extractMillisWithInfinit
*/
@Tags({"snowflake", "dbcp", "jdbc", "database", "connection", "pooling", "store"})
@CapabilityDescription("Provides Snowflake Connection Pooling Service. Connections can be asked from pool and returned after usage.")
+@SupportsSensitiveDynamicProperties
@DynamicProperties({
@DynamicProperty(name = "JDBC property name",
value = "Snowflake JDBC property value",
expressionLanguageScope = ExpressionLanguageScope.VARIABLE_REGISTRY,
- description = "Snowflake JDBC driver property name and value applied to JDBC connections."),
- @DynamicProperty(name = "SENSITIVE.JDBC property name",
- value = "Snowflake JDBC property value",
- expressionLanguageScope = ExpressionLanguageScope.NONE,
- description = "Snowflake JDBC driver property name prefixed with 'SENSITIVE.' handled as a sensitive property.")
+ description = "Snowflake JDBC driver property name and value applied to JDBC connections.")
})
@RequiresInstanceClassLoading
public class SnowflakeComputingConnectionPool extends AbstractDBCPConnectionPool implements SnowflakeConnectionProviderService {
@@ -180,6 +178,19 @@ public class SnowflakeComputingConnectionPool extends AbstractDBCPConnectionPool
return PROPERTIES;
}
+ @Override
+ protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) {
+ final PropertyDescriptor.Builder builder = new PropertyDescriptor.Builder()
+ .name(propertyDescriptorName)
+ .required(false)
+ .dynamic(true)
+ .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+ .addValidator(StandardValidators.createAttributeExpressionLanguageValidator(AttributeExpression.ResultType.STRING, true))
+ .addValidator(StandardValidators.ATTRIBUTE_KEY_PROPERTY_NAME_VALIDATOR);
+
+ return builder.build();
+ }
+
@Override
protected Collection<ValidationResult> customValidate(final ValidationContext context) {
return Collections.emptyList();
@@ -188,7 +199,7 @@ public class SnowflakeComputingConnectionPool extends AbstractDBCPConnectionPool
@Override
protected DataSourceConfiguration getDataSourceConfiguration(final ConfigurationContext context) {
final String url = getUrl(context);
- final String driverName = context.getProperty(DB_DRIVERNAME).evaluateAttributeExpressions().getValue();
+ final String driverName = SnowflakeDriver.class.getName();
final String user = context.getProperty(DB_USER).evaluateAttributeExpressions().getValue();
final String password = context.getProperty(DB_PASSWORD).evaluateAttributeExpressions().getValue();
final Integer maxTotal = context.getProperty(MAX_TOTAL_CONNECTIONS).evaluateAttributeExpressions().asInteger();
@@ -225,7 +236,7 @@ public class SnowflakeComputingConnectionPool extends AbstractDBCPConnectionPool
@Override
protected Driver getDriver(final String driverName, final String url) {
try {
- Class.forName(SnowflakeDriver.class.getName());
+ Class.forName(driverName);
return DriverManager.getDriver(url);
} catch (Exception e) {
throw new ProcessException("Snowflake driver unavailable or incompatible connection URL", e);