| Summary: | [CDO] Provide Unit tests for the "load notification API" | ||
|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Alexandre Borgoltz <alexandre.borgoltz> |
| Component: | cdo.core | Assignee: | Project Inbox <emf.cdo-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | alexandre.borgoltz, stepper |
| Version: | 4.13 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Alexandre Borgoltz
Eike,
I have written a small unit test for the "load notification" API. But it fails.
I guess I misunderstood the awaited behaviour and/or way of using it.
Here's what I have done:
1. register an adapter at constructor time in the model - the adapter sets private fields to true when it is notified
2. get view and call view.options().setLoadNotificationEnabled(true) before I retreive a resource and objects in the resource
3. check private fields have been set to true when the object is retreived through via the view
Illustration for 1. :
{
eAdapters().add(new AdapterImpl()
{
@Override
public void notifyChanged(Notification msg)
{
if (msg.getFeature().equals(Model6Package.Literals.G__DUMMY))
{
attributeModified = true;
}
else if (msg.getFeature().equals(Model6Package.Literals.G__REFERENCE))
{
referenceModified = true;
}
else if (msg.getFeature().equals(Model6Package.Literals.G__LIST))
{
listModified = true;
}
}
});
}
Illustration for 2. and 3.:
{// in a view, with load notification enabled
CDOSession session = openSession();
CDOView view = session.openView();
// enable
view.options().setLoadNotificationEnabled(true);
Resource resource = view.getResource(RESOURCE_NAME);
G g = (G)resource.getContents().get(0);
assertEquals(true, g.isAttributeModified());
assertEquals(true, g.isListModified());
assertEquals(true, g.isReferenceModified());
view.close();
session.close();
}
Result: the first assert in the code sample above fails.
Did I misunderstand something?
--
Alexandre
Please attach all your changes as a Git patch ("git diff > xyz.patch") so that i can try and debug it ;-)
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master. Moving all outstanding enhancements to 4.3 Moving all open enhancement requests to 4.4 Moving all open enhancement requests to 4.4 Moving all open bugzillas to 4.5. Moving all unaddressed bugzillas to 4.6. Moving all open bugs to 4.7 Moving all unresolved issues to version 4.8- Moving all unresolved issues to version 4.9 Moving to 4.13. |