This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-dbcp.git
commit f1e8e5364432c3f16d9fd12ce4c2dfcb0f6f1b4f Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Nov 23 08:49:40 2024 -0500 org.apache.commons.dbcp2.datasources.TestFactory is now a @ParameterizedTest --- .../commons/dbcp2/datasources/TestFactory.java | 40 +++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestFactory.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestFactory.java index 1ac7463b..9638b769 100644 --- a/src/test/java/org/apache/commons/dbcp2/datasources/TestFactory.java +++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestFactory.java @@ -30,7 +30,7 @@ import javax.naming.StringRefAddr; import javax.naming.spi.ObjectFactory; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; +import org.junit.jupiter.params.provider.CsvSource; /** * Tests SharedPoolDataSourceFactory. @@ -44,14 +44,38 @@ public class TestFactory { * https://issues.apache.org/bugzilla/show_bug.cgi?id=24082 */ @ParameterizedTest - @ValueSource(strings = { "dataSourceName", "description", "jndiEnvironment", "loginTimeout", "blockWhenExhausted", "evictionPolicyClassName", "lifo", - "maxIdlePerKey", "maxTotalPerKey", "maxWaitMillis", "minEvictableIdleTimeMillis", "minIdlePerKey", "numTestsPerEvictionRun", - "softMinEvictableIdleTimeMillis", "testOnCreate", "testOnBorrow", "testOnReturn", "testWhileIdle", "timeBetweenEvictionRunsMillis", - "validationQuery", "validationQueryTimeout", "rollbackAfterValidation", "maxConnLifetimeMillis", "defaultAutoCommit", "defaultTransactionIsolation", - "defaultReadOnly" }) - public void testJNDI2Pools(final String string) throws Exception { + // @formatter:off + @CsvSource({ + "dataSourceName, java:comp/env/jdbc/bookstoreCPDS", + "description, This is a test.", + "jndiEnvironment, X", + "loginTimeout, 30000", + "blockWhenExhausted, false", + "evictionPolicyClassName, org.apache.commons.pool2.impl.DefaultEvictionPolicy", + "lifo, true", + "maxIdlePerKey, 4", + "maxTotalPerKey, 4", + "maxWaitMillis, 30001", + "minEvictableIdleTimeMillis, 30002", + "minIdlePerKey, 4", + "numTestsPerEvictionRun, 2", + "softMinEvictableIdleTimeMillis, 30003", + "testOnCreate, true", + "testOnBorrow, true", + "testOnReturn, true", + "testWhileIdle, true", + "timeBetweenEvictionRunsMillis, 30004", + "validationQuery, select 1", + "validationQueryTimeout, 30005", + "rollbackAfterValidation, false", + "maxConnLifetimeMillis, 60000", + "defaultAutoCommit, true", + "defaultTransactionIsolation, X", + "defaultReadOnly, true" }) + // @formatter:on + public void testJNDI2Pools(final String string, final String value) throws Exception { final Reference refObj = new Reference(SharedPoolDataSource.class.getName()); - refObj.add(new StringRefAddr(string, "TestValue")); + refObj.add(new StringRefAddr(string, value)); final Context context = new InitialContext(); final Hashtable<?, ?> env = new Hashtable<>();