svn commit: r27896 - /release/commons/commons-release-plugin/commons-release-plugin-47-src.zip.sha1
Author: chtompki Date: Tue Jul 3 12:15:57 2018 New Revision: 27896 Log: Remove svnmucc commons-parent-47 release mistake Removed: release/commons/commons-release-plugin/commons-release-plugin-47-src.zip.sha1
[lang] Update to commons-parent version 47
Repository: commons-lang Updated Branches: refs/heads/master f56931c17 -> c241b096d Update to commons-parent version 47 Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/c241b096 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/c241b096 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/c241b096 Branch: refs/heads/master Commit: c241b096d32f9ece918466f3614c143e8679dac5 Parents: f56931c Author: pascalschumacher Authored: Tue Jul 3 19:17:52 2018 +0200 Committer: pascalschumacher Committed: Tue Jul 3 19:17:52 2018 +0200 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/c241b096/pom.xml -- diff --git a/pom.xml b/pom.xml index 12760db..aafeb24 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ org.apache.commons commons-parent -46 +47 4.0.0 commons-lang3
Nexus: Staging Repository Dropped
Message from: https://repository.apache.orgDescription:Drop Apache Commons Pool 2.6.0 RC1.Deployer properties:"userAgent" = "Apache-Maven/3.5.4 (Java 1.8.0_172; Windows 10 10.0)""userId" = "ggregory""ip" = "97.122.219.125"Details:The orgapachecommons-1341 staging repository has been dropped.Action performed by Gary D. Gregory (ggregory)
svn commit: r27909 - in /dev/commons/pool: ./ 2.6.0-RC1/ 2.6.0-RC1/binaries/ 2.6.0-RC1/site/ 2.6.0-RC1/site/apidocs/ 2.6.0-RC1/site/apidocs/org/ 2.6.0-RC1/site/apidocs/org/apache/ 2.6.0-RC1/site/apido
Author: ggregory Date: Tue Jul 3 22:04:05 2018 New Revision: 27909 Log: Staging release: commons-pool2, version: 2.6.0 [This commit notification would consist of 86 parts, which exceeds the limit of 50 ones, so it was shortened to the summary.]
svn commit: r27910 - in /dev/commons/pool: 2.6.0-RC1/ site.zip
Author: ggregory Date: Tue Jul 3 22:05:11 2018 New Revision: 27910 Log: Prepare for Apache Commons Pool 2.6.0 RC1. Removed: dev/commons/pool/2.6.0-RC1/ dev/commons/pool/site.zip
[commons-pool] Git Push Summary
Repository: commons-pool Updated Tags: refs/tags/commons-pool-2.6.0-RC1 [deleted] 55b48217f
commons-pool git commit: Prepare for 2.6.0.
Repository: commons-pool Updated Branches: refs/heads/release a71cbc9ec -> 281258e54 Prepare for 2.6.0. Project: http://git-wip-us.apache.org/repos/asf/commons-pool/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-pool/commit/281258e5 Tree: http://git-wip-us.apache.org/repos/asf/commons-pool/tree/281258e5 Diff: http://git-wip-us.apache.org/repos/asf/commons-pool/diff/281258e5 Branch: refs/heads/release Commit: 281258e546f761a00e3379d7db4d6744e721d3c3 Parents: a71cbc9 Author: Gary Gregory Authored: Tue Jul 3 18:07:52 2018 -0400 Committer: Gary Gregory Committed: Tue Jul 3 18:07:52 2018 -0400 -- pom.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-pool/blob/281258e5/pom.xml -- diff --git a/pom.xml b/pom.xml index 975f148..e2078a2 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ org.apache.commons commons-parent -46 +47 4.0.0 commons-pool2 @@ -177,7 +177,6 @@ 2.5.0 true - scm:svn:https://dist.apache.org/repos/dist/dev/commons/${commons.componentid}/${commons.release.version}-${commons.rc.version} Gary Gregory 86fdc7e2a11262cb
[commons-pool] Git Push Summary
Repository: commons-pool Updated Tags: refs/tags/commons-pool-2.6.0-RC1 [created] d218491e3
svn commit: r27911 - in /dev/commons/pool/2.6.0-RC1: ./ binaries/ site/ site/apidocs/ site/apidocs/org/ site/apidocs/org/apache/ site/apidocs/org/apache/commons/ site/apidocs/org/apache/commons/pool2/
Author: ggregory Date: Tue Jul 3 22:20:54 2018 New Revision: 27911 Log: Staging release: commons-pool2, version: 2.6.0 [This commit notification would consist of 86 parts, which exceeds the limit of 50 ones, so it was shortened to the summary.]
Nexus: Staging Completed
Message from: https://repository.apache.orgDescription:Close Apache Commons Pool 2.6.0 RC1.Deployer properties:"userAgent" = "Apache-Maven/3.5.4 (Java 1.8.0_172; Windows 10 10.0)""userId" = "ggregory""ip" = "97.122.219.125"Details:The following artifacts have been staged/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0-javadoc.jar(SHA1: fd4b11c3fbf3bc883ce7df8de04962e212cc4277)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0-test-sources.jar.asc(SHA1: b59fe31b13736e3437608cabb3643a53688b211e)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0-tests.jar.asc(SHA1: ce1a3ac57b9257d3ea6491a807d3e59f1d3ad38f)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0-sources.jar(SHA1: 6b5036e509a52fe820c9c5a42dbf341f948e729f)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0-tests.jar(SHA1: f29918fe848dd6393a77f944d7d8369703a90726)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0.pom.asc(SHA1: 7c00018a883cc14e09bff506985636280900f881)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0.pom(SHA1: 5b349b2f4a20f49011a00dcbb59f61ab27f68d8f)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0-test-sources.jar(SHA1: 7b959b3c98ddfcdc0ee296d4e3c2af0ffdbbe765)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0-sources.jar.asc(SHA1: 3f7319a3259349b609d229c5e38e67b0fd2ec31b)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0-javadoc.jar.asc(SHA1: c126e1ffef27bda6116ca42041b4511bd562edbf)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0.jar(SHA1: df5f4f61183daa8c4c1a9361c7b3ce2b67218eb2)/org/apache/commons/commons-pool2/2.6.0/commons-pool2-2.6.0.jar.asc(SHA1: 7263fdf0061506d25f59b22ae86c2fc8ad6a308b)Action performed by Gary D. Gregory (ggregory)
[1/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.
Repository: commons-dbcp Updated Branches: refs/heads/master 629040340 -> 64a13ee39 http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/managed/TestLocalXaResource.java -- diff --git a/src/test/java/org/apache/commons/dbcp2/managed/TestLocalXaResource.java b/src/test/java/org/apache/commons/dbcp2/managed/TestLocalXaResource.java new file mode 100644 index 000..7efe5ca --- /dev/null +++ b/src/test/java/org/apache/commons/dbcp2/managed/TestLocalXaResource.java @@ -0,0 +1,590 @@ +/* + * + * 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.commons.dbcp2.managed; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.sql.Array; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.NClob; +import java.sql.PreparedStatement; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Struct; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Executor; + +import javax.transaction.xa.XAException; +import javax.transaction.xa.XAResource; +import javax.transaction.xa.Xid; + +import org.junit.Before; +import org.junit.Test; + +/** + * Tests for LocalXAConnectionFactory$LocalXAResource + */ +public class TestLocalXaResource { + +private Connection conn; +private LocalXAConnectionFactory.LocalXAResource resource; + +@Before +public void setUp() { +conn = new TestConnection(); +resource = new LocalXAConnectionFactory.LocalXAResource(conn); +} + +@Test +public void testConstructor() { +assertEquals(0, resource.getTransactionTimeout()); +assertNull(resource.getXid()); +// the current implementation always return false, regardless of the input value +assertFalse(resource.setTransactionTimeout(100)); +// the current implementation always return an empty/zero'd array, regardless of the input value +assertEquals(0, resource.recover(100).length); +} + +@Test +public void testIsSame() { +assertTrue(resource.isSameRM(resource)); +assertFalse(resource.isSameRM(new LocalXAConnectionFactory.LocalXAResource(conn))); +} + +@Test(expected=XAException.class) +public void testStartInvalidFlag() throws XAException { +// currently, valid values are TMNOFLAGS and TMRESUME +resource.start(null, XAResource.TMENDRSCAN); +} + +@Test(expected=XAException.class) +public void testStartNoFlagButAlreadyEnlisted() throws XAException { +resource.start(new TestXid(), XAResource.TMNOFLAGS); +resource.start(new TestXid(), XAResource.TMNOFLAGS); +} + +@Test(expected=XAException.class) +public void testStartNoFlagResumeButDifferentXid() throws XAException { +resource.start(new TestXid(), XAResource.TMNOFLAGS); +resource.start(new TestXid(), XAResource.TMRESUME); +} + +@Test +public void testStartNoFlagResume() throws XAException { +Xid xid = new TestXid(); +resource.start(xid, XAResource.TMNOFLAGS); +resource.start(xid, XAResource.TMRESUME); +assertEquals(xid, resource.getXid()); +} + +@Test +public void testStartNoFlagResumeEnd() throws XAException { +Xid xid = new TestXid(); +resource.start(xid, XAResource.TMNOFLAGS); +resource.start(xid, XAResource.TMRESUME); +// flag is never used in the end +resource.end(xid, 0); +assertEquals(xid, resource.getXid()); +} + +@Test(expected=NullPointerException.class) +public void testStartNoFlagResumeEndMissingXid() throws XAException { +Xid xid = new TestXid(); +resource.start(xid, XAResource.TMNOFLAGS); +resource.start(xid, XAResource.TMRESUME); +// flag is
[2/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.
http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java -- diff --git a/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java b/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java index 654a677..1a875d0 100644 --- a/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java +++ b/src/test/java/org/apache/commons/dbcp2/datasources/TestInstanceKeyDataSource.java @@ -18,37 +18,63 @@ package org.apache.commons.dbcp2.datasources; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; +import java.util.Properties; import org.apache.commons.dbcp2.cpdsadapter.DriverAdapterCPDS; +import org.junit.After; +import org.junit.Before; import org.junit.Test; /** */ public class TestInstanceKeyDataSource { +private DriverAdapterCPDS pcds; +private SharedPoolDataSource spds; + +private final static String DRIVER = "org.apache.commons.dbcp2.TesterDriver"; +private final static String URL = "jdbc:apache:commons:testdriver"; +private final static String USER = "foo"; +private final static String PASS = "bar"; + +@Before +public void setUp() throws ClassNotFoundException { +pcds = new DriverAdapterCPDS(); +pcds.setDriver(DRIVER); +pcds.setUrl(URL); +pcds.setUser(USER); +pcds.setPassword(PASS); +pcds.setPoolPreparedStatements(false); +spds = new SharedPoolDataSource(); +spds.setConnectionPoolDataSource(pcds); +} + +@After +public void tearDown() throws Exception { +spds.close(); +} + /** * Verify that exception on setupDefaults does not leak PooledConnection * * JIRA: DBCP-237 + * @throws Exception */ @Test public void testExceptionOnSetupDefaults() throws Exception { -DriverAdapterCPDS pcds; -pcds = new DriverAdapterCPDS(); -pcds.setDriver("org.apache.commons.dbcp2.TesterDriver"); -pcds.setUrl("jdbc:apache:commons:testdriver"); -pcds.setUser("foo"); -pcds.setPassword("bar"); -pcds.setPoolPreparedStatements(false); -final ThrowOnSetupDefaultsDataSource tds = new ThrowOnSetupDefaultsDataSource(); -tds.setConnectionPoolDataSource(pcds); +ThrowOnSetupDefaultsDataSource tds = new ThrowOnSetupDefaultsDataSource(); final int numConnections = tds.getNumActive(); try { -tds.getConnection("foo", "bar"); +tds.getConnection(USER, PASS); fail("Expecting SQLException"); } catch (final SQLException ex) { //Expected @@ -71,4 +97,215 @@ public class TestInstanceKeyDataSource { } } +@Test +public void testConnectionPoolDataSource() { +assertEquals(pcds, spds.getConnectionPoolDataSource()); +} + +@Test(expected=IllegalStateException.class) +public void testConnectionPoolDataSourceAlreadySet() { +spds.setConnectionPoolDataSource(new DriverAdapterCPDS()); +} + +@Test(expected=IllegalStateException.class) +public void testConnectionPoolDataSourceAlreadySetUsingJndi() { +spds = new SharedPoolDataSource(); +spds.setDataSourceName("anything"); +spds.setConnectionPoolDataSource(new DriverAdapterCPDS()); +} + +@Test +public void testDataSourceName() { +spds = new SharedPoolDataSource(); +assertNull(spds.getDataSourceName()); +spds.setDataSourceName("anything"); +assertEquals("anything", spds.getDataSourceName()); +} + +@Test(expected=IllegalStateException.class) +public void testDataSourceNameAlreadySet() { +spds.setDataSourceName("anything"); +} + +@Test(expected=IllegalStateException.class) +public void testDataSourceNameAlreadySetUsingJndi() { +spds = new SharedPoolDataSource(); +spds.setDataSourceName("anything"); +spds.setDataSourceName("anything"); +} + +@Test +public void testDefaultTransactionIsolation() { +assertEquals(SharedPoolDataSource.UNKNOWN_TRANSACTIONISOLATION, spds.getDefaultTransactionIsolation()); + spds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); +assertEquals(Connection.TRANSACTION_READ_COMMITTED, spds.getDefaultTransactionIsolation()); +} + +@Test(expected=IllegalArgumentException.class) +public void testDefaultTransactionIsolationInvalid() { +assertEquals(SharedPoolDataSource.UNKNOWN_TRANSACTIONIS
commons-dbcp git commit: [DBCP-504] Increase test coverage.
Repository: commons-dbcp Updated Branches: refs/heads/master 64a13ee39 -> bf8c42ba8 [DBCP-504] Increase test coverage. Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/bf8c42ba Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/bf8c42ba Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/bf8c42ba Branch: refs/heads/master Commit: bf8c42ba890eb82a33710b2519c0216fd0033a85 Parents: 64a13ee Author: Gary Gregory Authored: Tue Jul 3 19:56:24 2018 -0400 Committer: Gary Gregory Committed: Tue Jul 3 19:56:24 2018 -0400 -- src/changes/changes.xml | 3 +++ 1 file changed, 3 insertions(+) -- http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/bf8c42ba/src/changes/changes.xml -- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index f01b979..820ee67 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -79,6 +79,9 @@ The type attribute can be add,update,fix,remove. Prepared statement keys should take a Connection's schema into account. + +Increase test coverage. +
[4/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.
http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java -- diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java index 03a806b..57a339e 100644 --- a/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java +++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingDatabaseMetaData.java @@ -18,11 +18,16 @@ package org.apache.commons.dbcp2; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; -import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.ResultSet; +import java.sql.SQLException; import org.junit.Before; import org.junit.Test; @@ -32,31 +37,1453 @@ import org.junit.Test; */ public class TestDelegatingDatabaseMetaData { -private DelegatingConnection conn = null; -private Connection delegateConn = null; -private DelegatingDatabaseMetaData meta = null; -private DatabaseMetaData delegateMeta = null; +private TesterConnection testConn; +private DelegatingConnection conn = null; +private DelegatingDatabaseMetaData delegate = null; +private DatabaseMetaData obj = null; @Before public void setUp() throws Exception { -delegateConn = new TesterConnection("test", "test"); -delegateMeta = delegateConn.getMetaData(); -conn = new DelegatingConnection<>(delegateConn); -meta = new DelegatingDatabaseMetaData(conn,delegateMeta); +obj = mock(DatabaseMetaData.class); +testConn = new TesterConnection("test", "test"); +conn = new DelegatingConnection<>(testConn); +delegate = new DelegatingDatabaseMetaData(conn, obj); } @Test public void testGetDelegate() throws Exception { -assertEquals(delegateMeta,meta.getDelegate()); +assertEquals(obj ,delegate.getDelegate()); } @Test /* JDBC_4_ANT_KEY_BEGIN */ public void testCheckOpen() throws Exception { -final ResultSet rst = meta.getSchemas(); +delegate = new DelegatingDatabaseMetaData(conn, conn.getMetaData()); +final ResultSet rst = delegate.getSchemas(); assertTrue(!rst.isClosed()); conn.close(); assertTrue(rst.isClosed()); } /* JDBC_4_ANT_KEY_END */ + +@Test +public void testAllProceduresAreCallable() throws Exception { +try { +delegate.allProceduresAreCallable(); +} catch (SQLException e) {} +verify(obj, times(1)).allProceduresAreCallable(); +} + +@Test +public void testAllTablesAreSelectable() throws Exception { +try { +delegate.allTablesAreSelectable(); +} catch (SQLException e) {} +verify(obj, times(1)).allTablesAreSelectable(); +} + +@Test +public void testAutoCommitFailureClosesAllResultSets() throws Exception { +try { +delegate.autoCommitFailureClosesAllResultSets(); +} catch (SQLException e) {} +verify(obj, times(1)).autoCommitFailureClosesAllResultSets(); +} + +@Test +public void testDataDefinitionCausesTransactionCommit() throws Exception { +try { +delegate.dataDefinitionCausesTransactionCommit(); +} catch (SQLException e) {} +verify(obj, times(1)).dataDefinitionCausesTransactionCommit(); +} + +@Test +public void testDataDefinitionIgnoredInTransactions() throws Exception { +try { +delegate.dataDefinitionIgnoredInTransactions(); +} catch (SQLException e) {} +verify(obj, times(1)).dataDefinitionIgnoredInTransactions(); +} + +@Test +public void testDeletesAreDetectedInteger() throws Exception { +try { +delegate.deletesAreDetected(1); +} catch (SQLException e) {} +verify(obj, times(1)).deletesAreDetected(1); +} + +@Test +public void testDoesMaxRowSizeIncludeBlobs() throws Exception { +try { +delegate.doesMaxRowSizeIncludeBlobs(); +} catch (SQLException e) {} +verify(obj, times(1)).doesMaxRowSizeIncludeBlobs(); +} + +@Test +public void testGeneratedKeyAlwaysReturned() throws Exception { +try { +delegate.generatedKeyAlwaysReturned(); +} catch (SQLException e) {} +verify(obj, times(1)).generatedKeyAlwaysReturned(); +} + +@Test +public void testGetAttributesStringStringStringString() throws Exception { +try { +delegate.getAttributes("foo","foo","foo","foo"); +} catch (SQLExcepti
[5/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.
[DBCP-504] Increase test coverage. Closes #13. Project: http://git-wip-us.apache.org/repos/asf/commons-dbcp/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-dbcp/commit/64a13ee3 Tree: http://git-wip-us.apache.org/repos/asf/commons-dbcp/tree/64a13ee3 Diff: http://git-wip-us.apache.org/repos/asf/commons-dbcp/diff/64a13ee3 Branch: refs/heads/master Commit: 64a13ee391894a1aa8b9c0d40d91783d5804377d Parents: 6290403 Author: Bruno P. Kinoshita Authored: Tue Jul 3 19:56:06 2018 -0400 Committer: Gary Gregory Committed: Tue Jul 3 19:56:06 2018 -0400 -- pom.xml |7 + .../dbcp2/TestBasicDataSourceMXBean.java| 239 +++ .../org/apache/commons/dbcp2/TestConstants.java | 39 + .../dbcp2/TestDataSourceConnectionFactory.java | 120 ++ .../dbcp2/TestDelegatingCallableStatement.java | 1130 ++- .../dbcp2/TestDelegatingDatabaseMetaData.java | 1449 +- .../dbcp2/TestDelegatingPreparedStatement.java | 505 - .../commons/dbcp2/TestDelegatingResultSet.java | 1835 ++ .../commons/dbcp2/TestDelegatingStatement.java | 497 - .../dbcp2/TestDriverConnectionFactory.java | 48 + .../TestDriverManagerConnectionFactory.java | 25 + .../dbcp2/TestLifetimeExceededException.java| 41 + .../apache/commons/dbcp2/TestListException.java | 50 + .../org/apache/commons/dbcp2/TestPStmtKey.java | 65 + .../cpdsadapter/TestDriverAdapterCPDS.java | 80 + .../datasources/TestInstanceKeyDataSource.java | 257 ++- .../datasources/TestPerUserPoolDataSource.java | 1145 ++- .../commons/dbcp2/datasources/TestPoolKey.java | 65 + .../dbcp2/datasources/TestUserPassKey.java | 74 + .../managed/TestBasicManagedDataSource.java | 103 + .../dbcp2/managed/TestLocalXaResource.java | 590 ++ .../dbcp2/managed/TestManagedDataSource.java| 27 + .../managed/TestPoolableManagedConnection.java | 141 ++ 23 files changed, 8443 insertions(+), 89 deletions(-) -- http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/pom.xml -- diff --git a/pom.xml b/pom.xml index 96d4cb4..d4afca5 100644 --- a/pom.xml +++ b/pom.xml @@ -187,6 +187,13 @@ test + + org.mockito + mockito-core + 2.19.0 + test + + org.apache.geronimo.specs http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java -- diff --git a/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java new file mode 100644 index 000..1106073 --- /dev/null +++ b/src/test/java/org/apache/commons/dbcp2/TestBasicDataSourceMXBean.java @@ -0,0 +1,239 @@ +/* + * 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.commons.dbcp2; + +import static org.junit.Assert.assertNull; + +import org.junit.Test; + +/** + * Tests for BasicDataSourceMXBean. + */ +public class TestBasicDataSourceMXBean { + +/** + * Tests the interface defined default method. + */ +@Test +public void testDefaultSchema() { +assertNull(bean.getDefaultSchema()); +} + +private BasicDataSourceMXBean bean = new BasicDataSourceMXBean() { + +@Override +public boolean isPoolPreparedStatements() { +return false; +} + +@Override +public boolean isClosed() { +return false; +} + +@Override +public boolean isAccessToUnderlyingConnectionAllowed() { +return false; +} + +@Override +public int getValidationQueryTimeout() { +return 0; +} + +@Override +public String getValidationQuery() { +return null; +} + +@Override +public String getUsername() { +
[3/5] commons-dbcp git commit: [DBCP-504] Increase test coverage. Closes #13.
http://git-wip-us.apache.org/repos/asf/commons-dbcp/blob/64a13ee3/src/test/java/org/apache/commons/dbcp2/TestDelegatingResultSet.java -- diff --git a/src/test/java/org/apache/commons/dbcp2/TestDelegatingResultSet.java b/src/test/java/org/apache/commons/dbcp2/TestDelegatingResultSet.java new file mode 100644 index 000..f677fde --- /dev/null +++ b/src/test/java/org/apache/commons/dbcp2/TestDelegatingResultSet.java @@ -0,0 +1,1835 @@ +/* + * 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.commons.dbcp2; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Tests for DelegatingResultSet. + */ +@SuppressWarnings({ "deprecation", "unchecked", "rawtypes" }) // BigDecimal methods, and casting for mocks +public class TestDelegatingResultSet { + +private TesterConnection testConn; +private DelegatingConnection conn; +private ResultSet rs; +private DelegatingResultSet delegate; + +@Before +public void setUp() { +testConn = new TesterConnection("foo", "bar"); +conn = new DelegatingConnection(testConn); +rs = mock(ResultSet.class); +delegate = (DelegatingResultSet) DelegatingResultSet.wrapResultSet((Connection) conn, rs); +} + +@Test +public void testAbsolutes() throws Exception { +try { +delegate.absolute(1); +} catch (SQLException e) { +} +verify(rs, times(1)).absolute(1); +} + +@Test +public void testAbsoluteInteger() throws Exception { +try { +delegate.absolute(1); +} catch (SQLException e) { +} +verify(rs, times(1)).absolute(1); +} + +@Test +public void testAfterLast() throws Exception { +try { +delegate.afterLast(); +} catch (SQLException e) { +} +verify(rs, times(1)).afterLast(); +} + +@Test +public void testBeforeFirst() throws Exception { +try { +delegate.beforeFirst(); +} catch (SQLException e) { +} +verify(rs, times(1)).beforeFirst(); +} + +@Test +public void testCancelRowUpdates() throws Exception { +try { +delegate.cancelRowUpdates(); +} catch (SQLException e) { +} +verify(rs, times(1)).cancelRowUpdates(); +} + +@Test +public void testClearWarnings() throws Exception { +try { +delegate.clearWarnings(); +} catch (SQLException e) { +} +verify(rs, times(1)).clearWarnings(); +} + +@Test +public void testClose() throws Exception { +try { +delegate.close(); +} catch (SQLException e) { +} +verify(rs, times(1)).close(); +} + +@Test +public void testDeleteRow() throws Exception { +try { +delegate.deleteRow(); +} catch (SQLException e) { +} +verify(rs, times(1)).deleteRow(); +} + +@Test +public void testFindColumnString() throws Exception { +try { +delegate.findColumn("foo"); +} catch (SQLException e) { +} +verify(rs, times(1)).findColumn("foo"); +} + +@Test +public void testFirst() throws Exception { +try { +delegate.first(); +} catch (SQLException e) { +} +verify(rs, times(1)).first(); +} + +@Test +public void testGetArrayInteger() throws Exception { +try { +delegate.getArray(1); +} catch (SQLException e) { +} +verify(rs, times(1)).getArray(1); +} + +@Test +public void testGetArrayString() throws Exception { +try { +delegate.getArray("foo"); +} cat