[GitHub] [nifi] exceptionfactory commented on a change in pull request #5692: NIFI-9609 Added nifi-snowflake-bundle with a SnowflakeConnectionPool.
exceptionfactory commented on a change in pull request #5692: URL: https://github.com/apache/nifi/pull/5692#discussion_r801650101 ## File path: nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/test/java/org/apache/nifi/snowflake/service/SnowflakeConnectionPoolIT.java ## @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.snowflake.service; + +import org.apache.nifi.processor.AbstractSessionFactoryProcessor; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSessionFactory; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.util.TestRunner; +import org.apache.nifi.util.TestRunners; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +/** + * Set the following constants: + * SNOWFLAKE_URL + * SNOWFLAKE_USER + * SNOWFLAKE_PASSWORD + * TABLE_NAME + */ +public class SnowflakeConnectionPoolIT { +public static final String SNOWFLAKE_URL = "tm55946.us-east-2.aws.snowflakecomputing.com"; Review comment: The specific URL should be changed to something generic, perhaps `hostname.snowflakecomputing.com`. ## File path: nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java ## @@ -0,0 +1,265 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.snowflake.service; + +import net.snowflake.client.jdbc.SnowflakeDriver; +import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.lang3.StringUtils; +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.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.dbcp.DBCPConnectionPool; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.processor.util.StandardValidators; +import org.apache.nifi.reporting.InitializationException; + +import java.sql.Driver; +import java.sql.DriverManager; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Implementation of Database Connection Pooling Service for Snowflake. + * Apache DBCP is used for connection pooling functionality. + */ +@Tags({"snowflake", "dbcp", "jdbc", "database", "connection", "pooling", "store"}) +@CapabilityDescription("Provides Snowflake Connection Pooling Service. Connections can be asked from pool and returned after usage.") +@DynamicProperties({ +@DynamicProperty(name = "JDBC property name", +value = "Snowflake JDBC property value", +expressionLanguageScope = ExpressionLanguageScope.VARIABLE_REGISTRY, +
[GitHub] [nifi] exceptionfactory commented on a change in pull request #5692: NIFI-9609 Added nifi-snowflake-bundle with a SnowflakeConnectionPool.
exceptionfactory commented on a change in pull request #5692: URL: https://github.com/apache/nifi/pull/5692#discussion_r793828599 ## File path: nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java ## @@ -0,0 +1,314 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.snowflake.service; + +import net.snowflake.client.jdbc.SnowflakeDriver; +import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.lang3.StringUtils; +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.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnDisabled; +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.dbcp.DBCPConnectionPool; +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; +import org.apache.nifi.reporting.InitializationException; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Implementation of Database Connection Pooling Service for Snowflake. + * Apache DBCP is used for connection pooling functionality. + */ +@Tags({"snowflake", "dbcp", "jdbc", "database", "connection", "pooling", "store"}) +@CapabilityDescription("Provides Snowflake Connection Pooling Service. Connections can be asked from pool and returned after usage.") +@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.") +}) +@RequiresInstanceClassLoading +public class SnowflakeComputingConnectionPool extends DBCPConnectionPool { + +public static final PropertyDescriptor SNOWFLAKE_URL = new PropertyDescriptor.Builder() +.displayName("Snowflake URL") +.name("snowflake-url") +.description("E.g. 'cb56215.europe-west2.gcp.snowflakecomputing.com/?db=MY_DB'." + +" The '/?db=MY_DB' part can can have other connection parameters as well." + +" It can also be omitted but in that case tables need to be referenced with fully qualified names e.g. 'MY_DB.PUBLIC.MY_TABLe'.") +.defaultValue(null) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.required(true) +.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) +.build(); + +public static final PropertyDescriptor SNOWFLAKE_USER = new PropertyDescriptor.Builder() +.displayName("Snowflake User Name") +.name("snowflake-user") +.defaultValue(null) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) +.build(); + +public static final PropertyDescriptor SNOWFLAKE_PASSWORD = new PropertyDescriptor.Builder() +.displayName("Snowflake Password") +.name("snowflak
[GitHub] [nifi] exceptionfactory commented on a change in pull request #5692: NIFI-9609 Added nifi-snowflake-bundle with a SnowflakeConnectionPool.
exceptionfactory commented on a change in pull request #5692: URL: https://github.com/apache/nifi/pull/5692#discussion_r793802743 ## File path: nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java ## @@ -0,0 +1,314 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.snowflake.service; + +import net.snowflake.client.jdbc.SnowflakeDriver; +import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.lang3.StringUtils; +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.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnDisabled; +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.dbcp.DBCPConnectionPool; +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; +import org.apache.nifi.reporting.InitializationException; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Implementation of Database Connection Pooling Service for Snowflake. + * Apache DBCP is used for connection pooling functionality. + */ +@Tags({"snowflake", "dbcp", "jdbc", "database", "connection", "pooling", "store"}) +@CapabilityDescription("Provides Snowflake Connection Pooling Service. Connections can be asked from pool and returned after usage.") +@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.") +}) +@RequiresInstanceClassLoading +public class SnowflakeComputingConnectionPool extends DBCPConnectionPool { + +public static final PropertyDescriptor SNOWFLAKE_URL = new PropertyDescriptor.Builder() +.displayName("Snowflake URL") +.name("snowflake-url") +.description("E.g. 'cb56215.europe-west2.gcp.snowflakecomputing.com/?db=MY_DB'." + +" The '/?db=MY_DB' part can can have other connection parameters as well." + +" It can also be omitted but in that case tables need to be referenced with fully qualified names e.g. 'MY_DB.PUBLIC.MY_TABLe'.") +.defaultValue(null) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.required(true) +.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) +.build(); + +public static final PropertyDescriptor SNOWFLAKE_USER = new PropertyDescriptor.Builder() +.displayName("Snowflake User Name") +.name("snowflake-user") +.defaultValue(null) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) +.build(); + +public static final PropertyDescriptor SNOWFLAKE_PASSWORD = new PropertyDescriptor.Builder() +.displayName("Snowflake Password") +.name("snowflak
[GitHub] [nifi] exceptionfactory commented on a change in pull request #5692: NIFI-9609 Added nifi-snowflake-bundle with a SnowflakeConnectionPool.
exceptionfactory commented on a change in pull request #5692: URL: https://github.com/apache/nifi/pull/5692#discussion_r793802743 ## File path: nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java ## @@ -0,0 +1,314 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.snowflake.service; + +import net.snowflake.client.jdbc.SnowflakeDriver; +import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.lang3.StringUtils; +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.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnDisabled; +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.dbcp.DBCPConnectionPool; +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; +import org.apache.nifi.reporting.InitializationException; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Implementation of Database Connection Pooling Service for Snowflake. + * Apache DBCP is used for connection pooling functionality. + */ +@Tags({"snowflake", "dbcp", "jdbc", "database", "connection", "pooling", "store"}) +@CapabilityDescription("Provides Snowflake Connection Pooling Service. Connections can be asked from pool and returned after usage.") +@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.") +}) +@RequiresInstanceClassLoading +public class SnowflakeComputingConnectionPool extends DBCPConnectionPool { + +public static final PropertyDescriptor SNOWFLAKE_URL = new PropertyDescriptor.Builder() +.displayName("Snowflake URL") +.name("snowflake-url") +.description("E.g. 'cb56215.europe-west2.gcp.snowflakecomputing.com/?db=MY_DB'." + +" The '/?db=MY_DB' part can can have other connection parameters as well." + +" It can also be omitted but in that case tables need to be referenced with fully qualified names e.g. 'MY_DB.PUBLIC.MY_TABLe'.") +.defaultValue(null) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.required(true) +.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) +.build(); + +public static final PropertyDescriptor SNOWFLAKE_USER = new PropertyDescriptor.Builder() +.displayName("Snowflake User Name") +.name("snowflake-user") +.defaultValue(null) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) +.build(); + +public static final PropertyDescriptor SNOWFLAKE_PASSWORD = new PropertyDescriptor.Builder() +.displayName("Snowflake Password") +.name("snowflak
[GitHub] [nifi] exceptionfactory commented on a change in pull request #5692: NIFI-9609 Added nifi-snowflake-bundle with a SnowflakeConnectionPool.
exceptionfactory commented on a change in pull request #5692: URL: https://github.com/apache/nifi/pull/5692#discussion_r792889162 ## File path: nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java ## @@ -0,0 +1,314 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.snowflake.service; + +import net.snowflake.client.jdbc.SnowflakeDriver; +import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.lang3.StringUtils; +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.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnDisabled; +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.dbcp.DBCPConnectionPool; +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; +import org.apache.nifi.reporting.InitializationException; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Implementation of Database Connection Pooling Service for Snowflake. + * Apache DBCP is used for connection pooling functionality. + */ +@Tags({"snowflake", "dbcp", "jdbc", "database", "connection", "pooling", "store"}) +@CapabilityDescription("Provides Snowflake Connection Pooling Service. Connections can be asked from pool and returned after usage.") +@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.") +}) +@RequiresInstanceClassLoading +public class SnowflakeComputingConnectionPool extends DBCPConnectionPool { + +public static final PropertyDescriptor SNOWFLAKE_URL = new PropertyDescriptor.Builder() +.displayName("Snowflake URL") +.name("snowflake-url") +.description("E.g. 'cb56215.europe-west2.gcp.snowflakecomputing.com/?db=MY_DB'." + +" The '/?db=MY_DB' part can can have other connection parameters as well." + +" It can also be omitted but in that case tables need to be referenced with fully qualified names e.g. 'MY_DB.PUBLIC.MY_TABLe'.") +.defaultValue(null) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.required(true) +.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) +.build(); + +public static final PropertyDescriptor SNOWFLAKE_USER = new PropertyDescriptor.Builder() +.displayName("Snowflake User Name") +.name("snowflake-user") +.defaultValue(null) +.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) +.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) +.build(); + +public static final PropertyDescriptor SNOWFLAKE_PASSWORD = new PropertyDescriptor.Builder() +.displayName("Snowflake Password") +.name("snowflak
[GitHub] [nifi] exceptionfactory commented on a change in pull request #5692: NIFI-9609 Added nifi-snowflake-bundle with a SnowflakeConnectionPool.
exceptionfactory commented on a change in pull request #5692: URL: https://github.com/apache/nifi/pull/5692#discussion_r792880955 ## File path: nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/test/java/org/apache/nifi/snowflake/service/SnowflakeConnectionPoolTest.java ## @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.snowflake.service; + +import org.apache.nifi.processor.AbstractSessionFactoryProcessor; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSessionFactory; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.util.TestRunner; +import org.apache.nifi.util.TestRunners; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +/** + * Set the following constants: + * SNOWFLAKE_URL + * SNOWFLAKE_PASSWORD + * SNOWFLAKE_PASSWORD + * TABLE_NAME + */ +@Disabled("Manual test.") Review comment: There are a handful of disabled tests that should be renamed to integration tests, so we should not continue that pattern. Disabled tests show up as warnings during builds, which is another reason to keep a clearer distinction between automated unit tests and manual integration tests. If this test could be run in an automated fashion, that would be great, but it does not work that way as it stands. As an alternative solution, JUnit 5 supports conditional annotations that would enable the test when environment variables or system properties are present. Adjusting to test to read the URL and credentials from environment variables would allow keeping this as a unit test, but making it conditional on the presence of those variables. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [nifi] exceptionfactory commented on a change in pull request #5692: NIFI-9609 Added nifi-snowflake-bundle with a SnowflakeConnectionPool.
exceptionfactory commented on a change in pull request #5692: URL: https://github.com/apache/nifi/pull/5692#discussion_r792819329 ## File path: nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/test/java/org/apache/nifi/snowflake/service/SnowflakeConnectionPoolTest.java ## @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.snowflake.service; + +import org.apache.nifi.processor.AbstractSessionFactoryProcessor; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSessionFactory; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.util.TestRunner; +import org.apache.nifi.util.TestRunners; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; + +/** + * Set the following constants: + * SNOWFLAKE_URL + * SNOWFLAKE_PASSWORD + * SNOWFLAKE_PASSWORD + * TABLE_NAME + */ +@Disabled("Manual test.") Review comment: This annotation should be removed and the class name should be changed to end with `IT` so it will be treated as an integration test and ignored for standard unit test execution. ## File path: nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-services/src/main/java/org/apache/nifi/snowflake/service/SnowflakeComputingConnectionPool.java ## @@ -0,0 +1,314 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi.snowflake.service; + +import net.snowflake.client.jdbc.SnowflakeDriver; +import org.apache.commons.dbcp2.BasicDataSource; +import org.apache.commons.lang3.StringUtils; +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.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.annotation.lifecycle.OnDisabled; +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.components.ValidationContext; +import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.dbcp.DBCPConnectionPool; +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; +import org.apache.nifi.reporting.InitializationException; + +import java.sql.Connection; +import java.sql.Driver; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Implementation of Database Connection Pooling Service for Snowflake. + * Apache DBCP is used for connection pooling functionality. + */ +@Tags({"snowflake", "dbcp", "jdbc", "database", "connection", "pooling", "store"}) +@CapabilityDescription("Provides Snowflake Connection Pooling Service. Connections can be asked from pool and returned after usage.") +@DynamicProperties({