Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » Junit Model discoverer
Junit Model discoverer [message #690358] Wed, 29 June 2011 12:28 Go to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 424
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


Re: Junit Model discoverer [message #690790 is a reply to message #690358] Thu, 30 June 2011 08:27 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 424
Registered: July 2009
Senior Member
Hi All,

I found out some information for the second question by myself.
I see from MethodInvocation i can get the MethodDeclaration through eContainer (There may be some better way to achieve the same).
What i would like to have is given the method declaration i would like to know what all other methods are invoked inside this method.

cheers,
Saurav


Re: Junit Model discoverer [message #690947 is a reply to message #690790] Thu, 30 June 2011 13:06 Go to previous messageGo to next message
Fabien Giquel is currently offline Fabien GiquelFriend
Messages: 138
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 #691019 is a reply to message #690947] Thu, 30 June 2011 15:03 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 424
Registered: July 2009
Senior Member
Hi Fabien,

Many thanks for the answers.It would be great if i can get hold of that code somehow.
Even i have asked the same in twitter http://twitter.com/#!/sauravs/status/86448289779687424

cheers,
Saurav


Re: Junit Model discoverer [message #691473 is a reply to message #691019] Fri, 01 July 2011 14:20 Go to previous messageGo to next message
Gregoire Dupe is currently offline Gregoire DupeFriend
Messages: 74
Registered: September 2009
Location: France
Member
Hello,

The JUnit example source code is available at http://www.mia-software.com/html/miaStudio/indexOfMiaStudio.php?lang=en&theme=download-modisco-examples

Regards,
Gregoire
Re: Junit Model discoverer [message #693354 is a reply to message #690358] Wed, 06 July 2011 10:00 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 424
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



Re: Junit Model discoverer [message #693806 is a reply to message #693354] Thu, 07 July 2011 08:36 Go to previous messageGo to next message
Nicolas Bros is currently offline Nicolas BrosFriend
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
Re: Junit Model discoverer [message #694322 is a reply to message #693806] Fri, 08 July 2011 10:34 Go to previous messageGo to next message
saurav sarkar is currently offline saurav sarkarFriend
Messages: 424
Registered: July 2009
Senior Member
Hi Nicolas,

I was able to do bring the discoverer in the discovery registry as well as in the UI.
Now will try to work on the functionality.

cheers,
Saurav


Re: Junit Model discoverer [message #694416 is a reply to message #694322] Fri, 08 July 2011 14:28 Go to previous messageGo to next message
Nicolas Bros is currently offline Nicolas BrosFriend
Messages: 49
Registered: July 2009
Member
Hi Saurav,

If you migrate the JUnit discoverer, we will be glad to accept your contribution.
Don't hesitate to ask if you have more questions.
Re: Junit Model discoverer [message #924358 is a reply to message #690358] Wed, 26 September 2012 19:34 Go to previous message
Benjamin Klatt is currently offline Benjamin KlattFriend
Messages: 36
Registered: September 2010
Member
Hi there,

have you been able to make any progress on the JUnit discovery example?
I would like to use this as a demo on our side.

Thanks
Benjamin
Previous Topic:KDM2Java
Next Topic:Processing the XMI of the KDM
Goto Forum:
  


Current Time: Wed Nov 26 11:49:00 GMT 2014

Powered by FUDForum. Page generated in 0.02505 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software