Re: [mdr-users] createExtent(String, RefObject, RefPackage[])
Martin Matula <[email protected]> Mon, 08 Aug 2005 21:03:01 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
The problem with your testcase is that it first reads in a UML metamodel (I will call it UML1) and instantiates it. So, you have UML1 and an instance of UML1. Now your testcase loads the trace metamodel (containing another copy of the UML metamodel - I will call this UML2 - it is another copy of the UML metamodel - the objects have different MOFIDs). The testcase instantiates it and passes UML1 instance as a parameter. MDR is instantiating tracing model and sees it clusters UML2 - the UML metamodel loaded in with the tracing metamodel). It is not in the array of RefPackages -> MDR creates a new instance of UML2. To fix this, you need to load the tracing metamodel. Now find UML package in this tracing metamodel and instantiate it. If you now find tracing package, instantiate it and pass in the instance of UML package, the instance of UML package will be reused. Regards, Martin Pieter Van Gorp wrote: >Hi all, > >On 8/5/05, Pieter Van Gorp <[email protected]> wrote: > > >>>>I passed a one-size array containing a UML extent to it but the >>>>clustered UML extent of my tracing extent (see >>>>http://www.fots.ua.ac.be/motmot/docs/traceability-p3.php) remains >>>>empty. >>>> >>>> >>>> >>>That's weird - it should work correctly. I.e. if package A clusters >>>package B and you create instance of B, then if you pass this instance B >>>into the createExtent() method to create extend A, the instance of B >>>should be reused. >>> >>> >>Well, this is not the case in my test: a call to >>handleToTraceModel.getUml().getCore().getAttribute().refAllOfClass().size() >>returns 0 while the original UML model contained a lot of attributes. >>My other mail also indicates the UML sub-extent is empty... I'll >>prepare a small test to reproduce this with minimal effort. >> >> >The problem can be reproduced by unpacking >http://www.fots.ua.ac.be/~pvgorp/tmp/crossreferences.tar.gz and >calling maven inside the "crossreferences" directory. As stated, the >following call (from testWriteXMIforUMLmodelClusteredWithinTraceModel) >illustrates that the nested UML extent does not contain the UML model >that was loaded from XMI: >logger.debug("Number of attributes within clustered UML model: >"+handleToTraceModel.getUml().getCore().getAttribute().refAllOfClass().size()); > >The source of the testcase is located in the tests directory. > >Looking forward to learn how to fix this, >thanks in advance, >Pieter. > >