commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Liviu Tudor (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (POOL-228) Unit test failure in TestGenericObjectPoolClassLoaders
Date Tue, 31 Jul 2012 00:47:33 GMT

    [ https://issues.apache.org/jira/browse/POOL-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13425430#comment-13425430
] 

Liviu Tudor commented on POOL-228:
----------------------------------

Problem is caused by the {{assertEquals}} in the following block (line 42):

{code:java}
GenericObjectPool<URL> pool1 = new GenericObjectPool<URL>(factory1);
pool1.setMinIdle(1);
pool1.setTimeBetweenEvictionRunsMillis(100);
Thread.sleep(200);
assertEquals("Wrong number of idle objects in pool1", 1, pool1.getNumIdle());
{code}

The trouble seems to rise from the fact that the constructor sets the {{minIdle}} by default
to 0 (zero); the call to {{setMinIdle}} sets it to 1 (one) and then the call to {{setTimeBetweenEvictionRunMillis(100)}}
schedules an eviction run in 100msecs. Therefore, bearing in mind the 200msecs sleep right
afterwards would mean that by the time we reach the {{assertEquals}} the pool would be pre-populated
with {{minIdle}} items.
However, the eviction procedures exits right away if the pool is empty (which makes sense,
there is nothing to evict!). 
So the question here is:
* do we change the unit test to assert the number of *existing* idle objects in the pool to
be zero (please note that the unit test checks for the existing idle objects not minimum idle
objects, which is set in previous step!) OR
* do we change the eviction to prepopulate to {{minIdle}} instances?


                
> Unit test failure in TestGenericObjectPoolClassLoaders
> ------------------------------------------------------
>
>                 Key: POOL-228
>                 URL: https://issues.apache.org/jira/browse/POOL-228
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Liviu Tudor
>            Priority: Minor
>              Labels: junit
>             Fix For: 1.6.1
>
>
> Following error encountered when running unit tests:
> {noformat}
> Results :
> Failed tests:   testContextClassLoader(org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders):
Wrong number of idle objects in pool1 expected:<1> but was:<0>
> Tests run: 263, Failures: 1, Errors: 0, Skipped: 0
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message