db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject Re: Cleanup in models.fieldtypes.Test*.java
Date Thu, 22 Sep 2005 15:47:11 GMT
Hi,

On Sep 22, 2005, at 2:58 AM, Michael Watzek wrote:

> Hi Michelle,
>
> the query tests implement the same strategy: They call method  
> 'QueryTest.cleanupDatabaseInternal' which calls  
> 'pm.deletePersistent'. Thus, TCK property  
> 'jdo.tck.cleanupaftertest' does not apply for those tests. We have  
> to adapt them also.

Agree.
>
> The finally block below is fine.

Actually, I took the finally block out of the sample because it  
duplicates code in the tearDown method in JDO_Test.

If there is only one test method in the test case, it's clearly not  
needed. Where it can still be useful is in cases where even if one of  
the tests fails, you still want to run the rest of the test methods  
and the cleanup allows other test methods to run. But the test class  
has already failed so it might not be so useful.

Craig
>
> Regards,
> Michael
>
>
>> Hi,
>> I've noticed that the fieldtypes tests, all created on the same  
>> pattern, delete the persistent instance that they create at the  
>> end of the test.  (For example, http://svn.apache.org/viewcvs.cgi/ 
>> incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/ 
>> fieldtypes/TestFieldsOfPrimitiveboolean.java?view=markup) Now that  
>> we use the new cleanup mechanism (addTearDownClass(Class)), there  
>> doesn't seem to be any point to deleting the instance.  Also, the  
>> new maven option jdo.tck.cleanupaftertest cannot override this  
>> cleanup, so you can never see the database contents for  
>> debugging.  Therefore, I think we should remove the line that  
>> deletes the persistent instance.
>> What about the finally block in these tests?
>> finally {
>>            if ((tx != null) && tx.isActive())
>>                tx.rollback();
>>        }
>> We don't do this in our sample test (http://wiki.apache.org/jdo/ 
>> SampleTest), which is supposed to be a model of excellence.  Is it  
>> a good idea or not?
>> -- Michelle
>>
>
>
> -- 
> -------------------------------------------------------------------
> Michael Watzek                  Tech@Spree Engineering GmbH
> mailto:mwa.tech@spree.de        Buelowstr. 66
> Tel.:  ++49/30/235 520 36       10783 Berlin - Germany
> Fax.:  ++49/30/217 520 12       http://www.spree.de/
> -------------------------------------------------------------------
>

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message