You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2024/05/27 22:25:38 UTC
(commons-pool) branch master updated: Improve test.
This is an automated email from the ASF dual-hosted git repository.
psteitz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-pool.git
The following commit(s) were added to refs/heads/master by this push:
new 19d4dd20 Improve test.
19d4dd20 is described below
commit 19d4dd2045181b6e243cdd4381061bafafc8457f
Author: Phil Steitz <ph...@gmail.com>
AuthorDate: Mon May 27 15:25:29 2024 -0700
Improve test.
---
.../java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java
index 77bb2ad7..9c0d2665 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java
@@ -433,6 +433,7 @@ public class TestAbandonedObjectPool {
abandonedConfig.setRemoveAbandonedOnMaintenance(true);
abandonedConfig.setLogAbandoned(true);
abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION);
+ abandonedConfig.setUseUsageTracking(true);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final BufferedOutputStream bos = new BufferedOutputStream(baos);
final PrintWriter pw = new PrintWriter(bos);
@@ -440,10 +441,13 @@ public class TestAbandonedObjectPool {
pool.setAbandonedConfig(abandonedConfig);
pool.setDurationBetweenEvictionRuns(Duration.ofMillis(100));
final PooledTestObject o1 = pool.borrowObject();
+ pool.use(o1);
Thread.sleep(2000);
assertTrue(o1.isDestroyed());
bos.flush();
- assertTrue(baos.toString().indexOf("Pooled object") >= 0);
+ final String traceString = baos.toString();
+ assertTrue(traceString.indexOf("Pooled object") >= 0);
+ assertTrue(traceString.indexOf("The last code to use this object was:") >= 0);
}
/**