Problem with CompositionCycleException

Matthias Köster <[email protected]> Wed, 21 Jul 2004 17:28:27 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Hi,

When i try to run a test like the following with the memory storage 
implementation

MDRepositoryCreator _creator;

Model model = createModel();
UmlPackage outerPackage = createUmlPackage();
outerPackage.refSetValue("namespace", model);
UmlPackage innerPackage = createUmlPackage();
innerPackage.refSetValue("namespace", outerPackage);

_creator.beginTransaction(true);
try {
  outerPackage.refSetValue("namespace", innerPackage);
  _creator.getInstance().endTransaction(false);
  fail("Expected CompositionCycleException!");
}
catch(CompositionCycleException e) {
  _creator.getInstance().endTransaction(true);
}

assertSame(outerPackage.refImmediateComposite(), model);

the test fails, but passes with the BTree storage. The example uses the 
UML metamodel, but should be reproducible with other metamodels that 
contain composite associations (the namespace association is a composite 
in UML).
To me this looks like a bug, since the rollback doesn't restore the 
composite inside the StorableObject. As far as i understand this problem 
at the moment, the problem doesn't occur with the Btree storage since it 
will reinitialize the StorableObject from disk.  What do you think?

Regards,
Matthias Köster