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 26ab567709f739bf47d8588a25e0347ffe2de5b6 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Nov 23 08:12:38 2024 -0500 org.apache.commons.dbcp2.datasources.TestFactory is now a @ParameterizedTest --- .../commons/dbcp2/datasources/TestFactory.java | 25 +++++++++++++++------- 1 file changed, 17 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 610652fe..1ac7463b 100644 --- a/src/test/java/org/apache/commons/dbcp2/datasources/TestFactory.java +++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestFactory.java @@ -29,20 +29,29 @@ import javax.naming.Reference; import javax.naming.StringRefAddr; import javax.naming.spi.ObjectFactory; -import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; /** + * Tests SharedPoolDataSourceFactory. */ public class TestFactory { - // Bugzilla Bug 24082: bug in InstanceKeyDataSourceFactory - // There's a fatal bug in InstanceKeyDataSourceFactory that means you can't - // instantiate more than one factory. - // https://issues.apache.org/bugzilla/show_bug.cgi?id=24082 - @Test - public void testJNDI2Pools() throws Exception { + /** + * Tests Bugzilla Bug 24082: bug in InstanceKeyDataSourceFactory. + * + * There's a fatal bug in InstanceKeyDataSourceFactory that means you can't instantiate more than one factory. + * 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 { final Reference refObj = new Reference(SharedPoolDataSource.class.getName()); - refObj.add(new StringRefAddr("dataSourceName","java:comp/env/jdbc/bookstoreCPDS")); + refObj.add(new StringRefAddr(string, "TestValue")); final Context context = new InitialContext(); final Hashtable<?, ?> env = new Hashtable<>();