db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bouschen <mbo.t...@spree.de>
Subject Re: JDO-58
Date Tue, 31 May 2005 18:19:34 GMT
Hi Michelle,

Michael W. and I discussed this as an alternative. The issue is that 
method getPMF might be called by the test method with the expectation to 
return "the" pmf instance. E.g. a test class might want to check whether 
the pmf is closed and calls getPMF().isClosed(). But getPMF returns a 
new pmf instance which is open and the test fails.

We thought we better do not change the behavior of getPMF, but fix the 
cleanup code in tearDown.

Regards Michael

> Alternatively, getPMF() could check to see if pmf is closed or null and 
> return a new pmf  in either case.
> 
> -- Michelle
> 
> Michael Watzek wrote:
> 
>> Hi,
>>
>> there are 5 tests (AfterCloseGetPMThrowsException, 
>> AfterCloseSetMethodsThrowException, Close, 
>> CloseFailsIfTransactionActive, 
>> CloseWithoutPermissionThrowsSecurityException) that call "getPMF()" 
>> and "pmf.close()" in their "testXXX" methods , but they do not nullify 
>> field "pmf". All of those tests fail in "localTearDown": 
>> "localTearDown" calls "getPMF()" which returns field "pmf" if it is 
>> not null. For this reason, "getPMF()" returnes a closed PMF in those 
>> tests.
>>
>> The proposal for a fix is to add a check before "localTearDown" is 
>> called:
>>
>> if (pmf!=null && pmf.isClosed())
>>     pmf = null;
>>
>> Regards,
>> Michael
> 
> 


-- 
Michael Bouschen		Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de	http://www.tech.spree.de/
Tel.:++49/30/235 520-33		Buelowstr. 66			
Fax.:++49/30/2175 2012		D-10783 Berlin			

Mime
View raw message