Model Creation and Testing using Eclipse plug-ins
-
Upload
bert-montoya -
Category
Documents
-
view
40 -
download
3
description
Transcript of Model Creation and Testing using Eclipse plug-ins
![Page 1: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/1.jpg)
Model Creation and Testing using Eclipse plug-ins
![Page 2: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/2.jpg)
Prerequisite for this tutorial….
![Page 3: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/3.jpg)
Plug-ins that you need….
Eclipse UML2 version 2.1.0 (md5)
Eclipse EMF version 2.3.0
Omondo’s EclipseUML version 3.2.0 Studio
![Page 4: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/4.jpg)
For that you need……
Eclipse Version: 3.3.0
Build id: I20070222-0951
![Page 5: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/5.jpg)
The general rule:
You need to create a folder in your Eclipse dir. and then unzip the downloaded zip file
Look for “feature” and “plugin” folder in your created folder after every download of a plug-in.
Copy and paste all the folders and files to the corresponding feature and plugin folder of the Eclipse folder.
Special note: A safe measure is to copy and paste all the .jar files of the plugins folder (in your created folder) separately into the plugins folder of Eclipse
![Page 6: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/6.jpg)
These folders should be in your eclipse directory……….
![Page 7: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/7.jpg)
The basic jar files required…….
![Page 8: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/8.jpg)
For Omondo UML:
![Page 9: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/9.jpg)
How to check your plug-ins:
![Page 10: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/10.jpg)
UML Modeling with Eclipse UML2
![Page 11: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/11.jpg)
Open Eclipse in ‘Resource’ perspective:
1) Select the Window > Open Perspective > Other… menu item.
2) Select the Resource perspective and press the OK button.
3) Select the File > New > Project... menu item.
4) Select the Project wizard from the General category and press the Next > button.
5) Enter a project name and press the Finish button.
![Page 12: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/12.jpg)
UML with Eclipse: The Starting Point
![Page 13: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/13.jpg)
Creating a model:
Select a project (i.e. Getting Started with UML2) in the Navigator view and select the File > New > Other... menu item.
2) Select the UML Model wizard from the Example EMF Model Creation Wizards category and press the Next > button.
3) Enter a file name (i.e. “ExtendedPO2.uml”) and press the Next > button.
4) Select Model for the model object and press the Finish button.
5) Select the Window > Show View > Properties menu item.
6) Select the <Model> element in the UML editor.
7) Enter a value (i.e. “epo2”) for the Name property in the Properties view.
![Page 14: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/14.jpg)
How to generate primitive types:
1) Select a package (i.e. <Model> epo2) in the UML editor.
2) Right-click and select the New Child > Packaged Element Primitive Type option from the context menu.
3) Enter a value (i.e. “int”) for the Name property in the Properties view.
![Page 15: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/15.jpg)
How to generate Classes:
Select a package (ex. <Model> epo2) in the UML editor.
Right-click and select the New Child > Packaged Element Class option from the context menu.
Enter a value (i.e. “Supplier”) for the Name property in the Properties view
![Page 16: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/16.jpg)
How to generate Classes & Types:
![Page 17: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/17.jpg)
How to generate generalizations:
Select a classifier (i.e. <Class> USAddress) in the UML editor.
Right-click and select the New Child > Generalization option from the context menu.
Select a value (i.e. epo2::Address) for the General property in the Properties view.
![Page 18: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/18.jpg)
How to generate generalizations:
![Page 19: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/19.jpg)
How to generate properties:
Select a classifier (i.e. <Class> Supplier) in the UML editor.
Right-click and select the New Child > Property option from the context menu.
Enter a value (i.e. "name”) for the Name property in the Properties view.
Select a value (i.e. epo2::String) for the Type property in the Properties view.
Enter a value (i.e. 0) for the Lower property in the Properties view.
![Page 20: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/20.jpg)
How to generate properties:
![Page 21: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/21.jpg)
How to generate association -I
Select a package (i.e. <Model> epo2) in the UML editor.
Right-click and select the New Child > Packaged Element Association option from the context menu.
Enter a value (e.g. “A_supplier_orders”) for the Name property in the Properties view.
Select the association (i.e. <Association> A_supplier_orders) in the UML editor.
Right-click and select the New Child > Property option from the context menu.
Select a value (i.e. epo2::Supplier) for the Type property in the Properties view.
Select a class (i.e. <Class> Supplier) in the UML editor.
![Page 22: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/22.jpg)
How to generate association -II
Right-click and select the New Child > Property option from the context menu.
Select a value (i.e. Composite) for the Aggregation property in the Properties view.
Select a value (i.e. epo2::A_supplier_orders) for the Association property in the Properties view.
Enter a value (i.e. "orders") for the Name property in the Properties view.
Select a value (i.e. epo2::PurchaseOrder) for the Type property in the Properties view.
Enter a value (i.e. 0) for the Lower property in the Properties view.
Enter a value (i.e. *) for the Upper property in the Properties view.
![Page 23: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/23.jpg)
How to generate association:
![Page 24: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/24.jpg)
EMF Vs Omondo
The Eclipse Modeling Project (EMF is a product of that) focus is to provide a unified set of model-based development technologies.
Omondo's focus is to provide UML/MDA model development tools.
![Page 25: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/25.jpg)
Working with EMF models
![Page 26: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/26.jpg)
Creating an EMF project:
![Page 27: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/27.jpg)
Creating ECore model -I
![Page 28: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/28.jpg)
Creating ECore model -II
![Page 29: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/29.jpg)
Creating ECore model -III
![Page 30: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/30.jpg)
Creating ECore model -IV
![Page 31: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/31.jpg)
Creating an EMF Class:
![Page 32: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/32.jpg)
Creating EMF enumerations:
![Page 33: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/33.jpg)
Setting Enumeration types:
![Page 34: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/34.jpg)
Creating EMF attributes:
![Page 35: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/35.jpg)
Setting OCL type:
![Page 36: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/36.jpg)
Setting OCL constraint:
![Page 37: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/37.jpg)
Working with Eclipse JUnit(No plug-in required… )
![Page 38: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/38.jpg)
JUnit Elements:
Test Case Class: Named [classname]Test.java, where classname is the name of the class that is being tested.
Test Case Method: Named test[methodname], where methodname is the name of the method that is tested.
Test Suite: Default name for Eclipse is AllTests.java
![Page 39: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/39.jpg)
Creating test class
Select File > New > JUnit Test Case OR
Select the arrow of the button in the upper left of the toolbar. Select JUnit Test Case
OR Right click on a package in the Package Explorer view in
the Java Perspective, and select JUnitTestCase OR
Click on the arrow of the icon in the toolbar. Select JUnit Test Case .
OR You can create a normal Java class but include
junit.framework.TestCase as the super class of the test class you are creating.
![Page 40: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/40.jpg)
Points to be noted….
Check to make sure that you are creating the TestCase in the proper package. Give the test case a name.
Use the Browse button to search for a different super class. The default super class junit.framework.TestCase.
Check which method stubs you would like to create. You can create a main method, setUp(), tearDown(), or a constructor(), but all of these are optional.
A constructor is only run when the test case class is first
instantiated, but the setUp() and tearDown() methods are run before and after, respectively, each test case is run.
![Page 41: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/41.jpg)
Running your test case/suite:
You can right click on the test case class or test suite class and select Run As > JUnit Test.
OR You can select a test case or suite and click the arrow on
the icon or select Run from the toolbar, and select Run As > JUnit Test.
OR You can select a test case or suite and click the arrow on
the icon or select Run from the toolbar, and select Run... From here you will create a new JUnit test configuration, and name it. You can choose to run a single test case, or run all test cases in a project or folder.
![Page 42: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/42.jpg)
Downloads:
1. Eclipse Download: http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/S-3.3M5eh-200702220951/
UML Download: (a) http://www.omondo.com/download/index.html
(b)http://www.eclipse.org/modeling/mdt/downloads/?project=uml2#uml2
2. EMF Download:
http://www.eclipse.org/downloads/download.php?file=/modeling/emf/emf/downloads/drops/2.3.0/S200706200000/emf-sdo-xsd-SDK-2.3.0RC4.zip
![Page 43: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/43.jpg)
References:
http://www.telecom-lille1.eu/people/Vanwormhoudt/siteEMFOCL/tutoriel/TutorialEMFOCL1.htm
http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getting_Started_with_UML2/article.html
http://open.ncsu.edu/se/tutorials/junit/
![Page 44: Model Creation and Testing using Eclipse plug-ins](https://reader036.fdocuments.in/reader036/viewer/2022062517/5681324d550346895d98c3a8/html5/thumbnails/44.jpg)
Thank you!