Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368206 - [CDO] Provide Unit tests for the "load notification API"
Summary: [CDO] Provide Unit tests for the "load notification API"
Status: NEW
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.13   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-09 18:41 EST by Alexandre Borgoltz CLA
Modified: 2020-12-11 10:44 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre Borgoltz CLA 2012-01-09 18:41:12 EST
Please provide unit test case for the recently created load notification API:


* CDOView.Options.setLoadNotificationEnabled(boolean) and
* boolean CDOView.Options.isLoadNotificationEnabled()
Comment 1 Alexandre Borgoltz CLA 2012-01-09 18:45:29 EST
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
Comment 2 Eike Stepper CLA 2012-01-10 06:48:03 EST
Please attach all your changes as a Git patch ("git diff > xyz.patch") so that i can try and debug it ;-)
Comment 3 Eike Stepper CLA 2012-08-14 22:54:11 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 4 Eike Stepper CLA 2013-06-27 04:09:20 EDT
Moving all outstanding enhancements to 4.3
Comment 5 Eike Stepper CLA 2014-08-19 09:29:12 EDT
Moving all open enhancement requests to 4.4
Comment 6 Eike Stepper CLA 2014-08-19 09:38:07 EDT
Moving all open enhancement requests to 4.4
Comment 7 Eike Stepper CLA 2015-07-14 02:16:23 EDT
Moving all open bugzillas to 4.5.
Comment 8 Eike Stepper CLA 2016-07-31 00:59:21 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 9 Eike Stepper CLA 2017-12-28 01:12:37 EST
Moving all open bugs to 4.7
Comment 10 Eike Stepper CLA 2019-11-08 02:04:45 EST
Moving all unresolved issues to version 4.8-
Comment 11 Eike Stepper CLA 2019-12-13 12:41:57 EST
Moving all unresolved issues to version 4.9
Comment 12 Eike Stepper CLA 2020-12-11 10:44:27 EST
Moving to 4.13.