On 10/19/2009 03:46 PM, Vladimir Blagojevic wrote:
You gotta be kidding! Are you sure that your method is annotated
with
@AfterClass and not @AfterTest. Is this in svn? I'd like to try it myself!
I'm not kidding and I'm sure :)
I've just committed it, r969. Do an svn updated, revert to the
AbstractInfinispanTest.nullifyInstanceFields and run
org.infinispan.jndi.BindingTest and you'll see an NPE being thrown in
the preDestroy() method.
On 09-10-19 7:55 AM, Galder Zamarreno wrote:
>
> On 10/19/2009 01:52 PM, Galder Zamarreno wrote:
>
>> Hi,
>>
>> I'm trying to modify SingleCacheManagerTest so that in the same way that
>> there's a preCreate() callback, there can be a preDestroy() callback
>> too. This is so that for example, in the
>>
https://jira.jboss.org/jira/browse/ISPN-153 test, I can stop the naming
>> server created at in preCreate().
>>
>> The problem though is that by the time either
>> SingleCacheManagerTest.destroyAfterClass is called,
>> AbstractInfinispanTest.nullifyInstanceFields has already run and I get NPEs.
>>
> Sorry, here meant: before SingleCacheManagerTest.preDestroy is called,
> AbstractInfinispanTest.nullifyInstanceFields has already run.
>
>
>> However, I see other cases such as
>> BdbjeCacheStoreFunctionalIntegrationTest where clearTempDir is called
>> before AbstractInfinispanTest.nullifyInstanceFields.
>>
>> I just run a test without the preDestroy() in SingleCacheManagerTest so
>> that there was only nullifyInstanceFields and destroyAfterClass
>> @AfterClass methods to called and destroyAfterClass was called first.
>> So, there does appear to be some kind alphabetical order in which testng
>> calls its @AfterClass methods.
>>
>> So, I've just tried to change
>> AbstractInfinispanTest.nullifyInstanceFields method name to
>> AbstractInfinispanTest.zzzNullifyInstanceFields and now the preDestroy()
>> gets called first.
>>
>> Any objections to this change?
>>
>> The other solution would to have some kind of dependsOnMethods in
>> AbstractInfinispanTest but that would force specific naming on
>> subclasses. Changing the name in AbstractInfinispanTest seems like a
>> much easier option.
>>
>
_______________________________________________
infinispan-dev mailing list
infinispan-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/infinispan-dev
--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache