You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2009/11/23 21:23:31 UTC

[DBCP] Noisy test output

The JUnit tests produce a lot of output, even if the tests are successful.

Is there really any need to print stack traces in the following method?

TestSharedPoolDataSource.PoolTest.run()

I propose to comment them out.

Similarly, the test case TestManual.testLogWriter() generates a lot of output.
It's not clear to me what the test is trying to achieve.
Any ideas?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [DBCP] Noisy test output

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> On 25/11/2009, Phil Steitz <ph...@gmail.com> wrote:
>> sebb wrote:
>>  > On 23/11/2009, sebb <se...@gmail.com> wrote:
>>  >> The JUnit tests produce a lot of output, even if the tests are successful.
>>  >>
>>  >>  Is there really any need to print stack traces in the following method?
>>  >>
>>  >>  TestSharedPoolDataSource.PoolTest.run()
>>  >>
>>  >>  I propose to comment them out.
>>  >>
>>  >>  Similarly, the test case TestManual.testLogWriter() generates a lot of output.
>>  >>  It's not clear to me what the test is trying to achieve.
>>  >>  Any ideas?
>>  >>
>>  >
>>  > Does anyone know what TestAbandonedBasicDataSource.testAbandoned() is
>>  > trying to test? It seems to be similar to testAbandonedClose() except
>>  > that it does not close the connections.
>>
>>
>> Looks like it is testing to make sure the "abandoned" connections
>>  get closed (the abandoned timeout is 0, maxActive is 1 and multiple
>>  connections are opened in sequence).
> 
> In that case, surely the test should check that the connection is
> automatically closed?
> 
> Or is that implicitly tested by the repeated opens?

Yes, because maxActive is set to 1.  This is really the behavior
that (sloppy ;) users count on from abandoned connection cleanup -
you can keep opening new connections without closing those that you
have opened already.

I notice now that while the TestAbandonedObjectPool test case does
validate that abandoned object cleanup destroys the abandoned
objects, there is no test case that explicitly verifies that
abandoned connections are in fact closed.  I just added a check for
this to TestAbandonedBasicDataSource.testClosed().

Thanks for pointing out these oddities in the tests.


Phil
> 
>>  > As far as I can tell it achieves nothing at present, except to print
>>  > some  useless messages on System.err. I propose to remove the
>>  > printouts (and inline the resulting one-line private methods)
>>
>>
>> Fixed.
>>
>>  Phil
>>  >
>>  > OK?
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  > For additional commands, e-mail: dev-help@commons.apache.org
>>  >
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [DBCP] Noisy test output

Posted by sebb <se...@gmail.com>.
On 25/11/2009, Phil Steitz <ph...@gmail.com> wrote:
> sebb wrote:
>  > On 23/11/2009, sebb <se...@gmail.com> wrote:
>  >> The JUnit tests produce a lot of output, even if the tests are successful.
>  >>
>  >>  Is there really any need to print stack traces in the following method?
>  >>
>  >>  TestSharedPoolDataSource.PoolTest.run()
>  >>
>  >>  I propose to comment them out.
>  >>
>  >>  Similarly, the test case TestManual.testLogWriter() generates a lot of output.
>  >>  It's not clear to me what the test is trying to achieve.
>  >>  Any ideas?
>  >>
>  >
>  > Does anyone know what TestAbandonedBasicDataSource.testAbandoned() is
>  > trying to test? It seems to be similar to testAbandonedClose() except
>  > that it does not close the connections.
>
>
> Looks like it is testing to make sure the "abandoned" connections
>  get closed (the abandoned timeout is 0, maxActive is 1 and multiple
>  connections are opened in sequence).

In that case, surely the test should check that the connection is
automatically closed?

Or is that implicitly tested by the repeated opens?

> >
>  > As far as I can tell it achieves nothing at present, except to print
>  > some  useless messages on System.err. I propose to remove the
>  > printouts (and inline the resulting one-line private methods)
>
>
> Fixed.
>
>  Phil
>  >
>  > OK?
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [DBCP] Noisy test output

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> On 23/11/2009, sebb <se...@gmail.com> wrote:
>> The JUnit tests produce a lot of output, even if the tests are successful.
>>
>>  Is there really any need to print stack traces in the following method?
>>
>>  TestSharedPoolDataSource.PoolTest.run()
>>
>>  I propose to comment them out.
>>
>>  Similarly, the test case TestManual.testLogWriter() generates a lot of output.
>>  It's not clear to me what the test is trying to achieve.
>>  Any ideas?
>>
> 
> Does anyone know what TestAbandonedBasicDataSource.testAbandoned() is
> trying to test? It seems to be similar to testAbandonedClose() except
> that it does not close the connections.

Looks like it is testing to make sure the "abandoned" connections
get closed (the abandoned timeout is 0, maxActive is 1 and multiple
connections are opened in sequence).
> 
> As far as I can tell it achieves nothing at present, except to print
> some  useless messages on System.err. I propose to remove the
> printouts (and inline the resulting one-line private methods)

Fixed.

Phil
> 
> OK?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [DBCP] Noisy test output

Posted by sebb <se...@gmail.com>.
On 23/11/2009, sebb <se...@gmail.com> wrote:
> The JUnit tests produce a lot of output, even if the tests are successful.
>
>  Is there really any need to print stack traces in the following method?
>
>  TestSharedPoolDataSource.PoolTest.run()
>
>  I propose to comment them out.
>
>  Similarly, the test case TestManual.testLogWriter() generates a lot of output.
>  It's not clear to me what the test is trying to achieve.
>  Any ideas?
>

Does anyone know what TestAbandonedBasicDataSource.testAbandoned() is
trying to test? It seems to be similar to testAbandonedClose() except
that it does not close the connections.

As far as I can tell it achieves nothing at present, except to print
some  useless messages on System.err. I propose to remove the
printouts (and inline the resulting one-line private methods)

OK?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org