| Junit Model discoverer [message #690358] |
Wed, 29 June 2011 08:28  |
saurav sarkar Messages: 416 Registered: July 2009 |
Senior Member |
|
|
Hi All,
I have couple of questions regarding MoDisco.
(a) Is there any Junit Model discoverer available or being thought of ? I feel it can be a kind of extension over Java Model discoverer.
(b) In Java Model discoverer.Under one Method Decalaration can i see what other method calls are happening within that specific method alongwith the parameters ?
cheers,
Saurav
My Blog http://codifyit.blogspot.com/
Follow me: http://twitter.com/sauravs
|
|
|
|
| Re: Junit Model discoverer [message #690947 is a reply to message #690790] |
Thu, 30 June 2011 09:06   |
Fabien Giquel Messages: 134 Registered: July 2009 |
Senior Member |
|
|
Hi,
(a) Migration from JUnit 3 to JUnit 4 was one demo subject at eclipsecon 2010 for MoDisco (http://www.slideshare.net/fmadiot/modisco-eclipsecon2010). It proposed some queries/facets for highlighting Junit3 key elements in one discovered Java model. Unfortunately, the code was not contributed into MoDisco SVN and it is now a little bit deprecated (frameworks have evolved). That is one goodd candidaite for Next MoDisco release but roadmap is not achieved now.
(b) MethodDeclaration has a body represented as a tree of java elements (statements, expressions, ...). MethodInvocation instances are contained indirectly at any deep level of this tree. So writing some recursive query, working generically with containment EReferences, would do the job. Such a query should look for "AbstractMethodInvocation" instances (4 subtypes).
----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
4, rue du Château de l'Eraudiere
44324 NANTES CEDEX 03
----------------------------------------------------
|
|
|
|
|
| Re: Junit Model discoverer [message #693354 is a reply to message #690358] |
Wed, 06 July 2011 06:00   |
saurav sarkar Messages: 416 Registered: July 2009 |
Senior Member |
|
|
Hi Fabien/Gregorie,
Thanks for the links provided.
I imported the classes and i found some incompatibilities.
As you mentioned the framework has evolved i found couple of problems in the code.
(a) The Junits Discoverer 'DiscoverTestsModelFromJavaModel' extends the deprecated DefaultDiscoverer.Which makes the Junit Discoverer uncompilable.Hence i am not able to run the discoverer.
(b) The facetSet, querySet and uiCustom in the org.eclipse.gmt.modisco.usecase.junit.testsuite.extension plug-in have the broken reference error.Are these facets been used ?
Any recent plans of migration of these plug-ins ?
I would be interested to help in any of the ways possible in this.
Cheers,
Saurav
My Blog http://codifyit.blogspot.com/
Follow me: http://twitter.com/sauravs
|
|
|
| Re: Junit Model discoverer [message #693806 is a reply to message #693354] |
Thu, 07 July 2011 04:36   |
Nicolas Bros Messages: 49 Registered: July 2009 |
Member |
|
|
The discovery framework was improved, and it is now much simpler to write discoverers than with the old framework.
If you want to migrate the JUnit discoverer to the new framework, you should:
- add a dependency to org.eclipse.modisco.infra.discovery.core (for the discoverer definition) instead of the old org.eclipse.gmt.modisco.infra.discoverymanager, and another dependency to org.eclipse.modisco.infra.discovery.ui for registering the discoverer in the UI
- extend org.eclipse.modisco.infra.discovery.core.AbstractModelDiscoverer<T> instead of DefaultDiscoverer. "T" is the source of the discovery, for example IFile or IProject
- define the discoverer parameters as methods or fields annotated with the "@Parameter" annotations, instead of the old DiscoveryParameter
- implement the methods isApplicableTo and basicDiscoverElement
- in basicDiscoverElement, define a default target with "setDefaultTargetURI", in case the user leaves the target URI blank
- still in basicDiscoverElement, create a Resource with "createTargetModel()", put the discovered elements in it, and call setTargetModel(resource) with this resource.
- remove the code that opens a model browser from the discoverer : this is now handled by the discovery framework
- register the discoverer with the extension point "org.eclipse.modisco.infra.discovery.core.discoverer"
- register the discoverer in the MoDisco context menu with the extension point "org.eclipse.modisco.infra.discovery.ui.discoverer"
- the discovery framework is designed so that the core and UI parts can be separated. So, the discoverer should preferably be put in a "core" plug-in, and the extension that registers it in a "UI" plug-in
The reference documentation for the discovery framework is:
http://wiki.eclipse.org/MoDisco/Components/DiscoverersManager/Documentation/0.9#Adopter_Features
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02549 seconds