db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: [jira] Commented: (JDO-187) Detach lifecycle listeners are incorrectly implemented
Date Sat, 22 Oct 2005 18:12:28 GMT
Hi Andy,

Thanks for the analysis and the fix.

You're right that the relevant part of the spec for the detach  
ordering doesn't specify the order of the callback and the listener.

The intent is for all the listeners and callbacks to use the same  
order: the pre-listener is called; the pre-callback is called; the  
post callback is called; and the post-listener is called. This is  
what all the other listeners do. What's missing is the description  
for the attach listener.

Here's the proposed change for the detach listener:

<spec>
package javax.jdo.listener;
public interface DetachLifecycleListener
     extends InstanceLifecycleListener {
A12.15-11 [void preDetach(InstanceLifecycleEvent event);
}
This method is called before a persistent instance is copied for  
detachment.]
A12.15-12 [void postDetach(InstanceLifecycleEvent event);
}
This method is called whenever a persistent instance is copied for  
detachment. The source instance is the detached copy; the target  
instance is the persistent instance.]
<spec>

<proposed>
package javax.jdo.listener;
public interface DetachLifecycleListener
     extends InstanceLifecycleListener {
A12.15-11 [void preDetach(InstanceLifecycleEvent event);
}
This method is called before a persistent instance is copied for  
detachment.] It is called before the jdoPreDetach callback.

A12.15-12 [void postDetach(InstanceLifecycleEvent event);
}
This method is called whenever a persistent instance is copied for  
detachment. The source instance is the detached copy; the target  
instance is the persistent instance. It is called after the  
jdoPostDetach callback on the detached copy.]
</proposed>

Thanks,

Craig


On Oct 22, 2005, at 12:54 AM, Andy Jefferson (JIRA) wrote:

>     [ http://issues.apache.org/jira/browse/JDO-187? 
> page=comments#action_12332756 ]
>
> Andy Jefferson commented on JDO-187:
> ------------------------------------
>
> Actually was an issue in InstanceCallbacks and not  
> InstanceLifecycleListener. JPOX CVS now uses the objects the other  
> way around on the postDetach and that part of the test passes. The  
> issue about
>
>     [java] Sequence verification failed for PRE_DETACH_LISTENER;  
> expected: <1> actual: <2>
>     [java]
>     [java] Sequence verification failed for PRE_DETACH_CALLBACK;  
> expected: <2> actual: <1>
>     [java]
>
> remains. This is down to the TCK test making the assumption that  
> the callback will appear before the lifecycle listener. Where is  
> this specifed in the JDO2 spec ? If there's no reference in the  
> spec then it can't be imposed in the TCK.
>
>
>> Detach lifecycle listeners are incorrectly implemented
>> ------------------------------------------------------
>>
>>          Key: JDO-187
>>          URL: http://issues.apache.org/jira/browse/JDO-187
>>      Project: JDO
>>         Type: Bug
>>   Components: tck20
>>  Environment: JPOX
>>     Reporter: Craig Russell
>>     Assignee: Andy Jefferson
>>
>
>
>>
>> The following errors are reported for test case  
>> InstanceLifecycleListenerDetach.
>>     [java] testDetach 
>> (org.apache.jdo.tck.api.instancecallbacks.InstanceLifecycleListenerDe 
>> tach)junit.framework.AssertionFailedError: Assertion A12.15-11  
>> (TestInstanceLifecycleListener) failed:
>>     [java] Assertion A12.15-12 (TestInstanceLifecycleListener)  
>> failed: in postDetach, target expected  
>> <org.apache.jdo.tck.api.instancecallbacks.InstanceLifecycleListenerDe 
>> tach$PC@2897ac>, actual <null>
>>     [java] Assertion A12.15-12 (TestInstanceLifecycleListener)  
>> failed: in postDetach, target object should be persistent.
>>     [java] Assertion A12.15-12 (TestInstanceLifecycleListener)  
>> failed: in postDetach, source wasPostDetachCalled() was not true.
>>     [java]
>>     [java] Sequence verification failed for PRE_DETACH_LISTENER;  
>> expected: <1> actual: <2>
>>     [java]
>>     [java] Sequence verification failed for PRE_DETACH_CALLBACK;  
>> expected: <2> actual: <1>
>>     [java]
>>     [java]      at  
>> org.apache.jdo.tck.api.instancecallbacks.AbstractInstanceLifecycleLis 
>> tener$InstanceLifecycleListenerImpl.verifyCallbacks 
>> (AbstractInstanceLifecycleListener.java:464)
>>     [java]      at  
>> org.apache.jdo.tck.api.instancecallbacks.InstanceLifecycleListenerDet 
>> ach.testDetach(InstanceLifecycleListenerDetach.java:108)
>>     [java]      at sun.reflect.NativeMethodAccessorImpl.invoke0 
>> (Native Method)
>>     [java]      at sun.reflect.NativeMethodAccessorImpl.invoke 
>> (NativeMethodAccessorImpl.java:39)
>>     [java]      at sun.reflect.DelegatingMethodAccessorImpl.invoke 
>> (DelegatingMethodAccessorImpl.java:25)
>>     [java]      at org.apache.jdo.tck.JDO_Test.runBare 
>> (JDO_Test.java:204)
>>     [java]      at org.apache.jdo.tck.util.BatchTestRunner.start 
>> (BatchTestRunner.java:120)
>>     [java]      at org.apache.jdo.tck.util.BatchTestRunner.main 
>> (BatchTestRunner.java:95)
>>
>
> -- 
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the  
> administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
>
>


Mime
View raw message