GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Junit_dev_basics Junit_dev_basics
Antonin Abhervé edited this page
As with many objects that constitute a packaged module, module (the object) creation is two part: XML declaration and Java coding. Module is the root element in the src/main/conf/res/module.xml file. 1 <Module
2 id="${project.name}"
3 version="${project.version}"
4 binaryversion="4.0.00"
5 class="org.modelio.junit.impl.JUnitModule"
6 schema-level="2">
The last files to edit are the manifest property files. There is one file per language supported with a default (without country code extension) that should be for English locale. module.properties file will look like : ModuleLabel=JUnit module ModuleDescription=Builds and manages test case for classes based on JUnit framework. module_fr.properties file for french will look like : ModuleLabel=Module JUnit ModuleDescription=Crée et gère les cas de test de classes basés sur JUnit A module contains :
The UML model detailed diagram for these classes is presented below.
Illustration 6: Module and Session The operations defined in src/main/java/org.modelio.junit.impl/JUnitLifeCycleHandler.java are automatically called according to the stat Module runtime states and events. We won’t dive into the gory details of these methods. We will see later (§7.7)that the start method will attach the module event listener to the Modelio event dispatch system. For more information on these methods. The implementation of session services for our JUnit module is very simple. 1package org.modelio.junit.impl;
2
3import java.util.Map;
4
5import org.modelio.api.module.context.log.ILogService;
6import org.modelio.api.module.lifecycle.DefaultModuleLifeCycleHandler;
7import org.modelio.api.module.lifecycle.ModuleException;
8import org.modelio.vbasic.version.Version;
9
10/**
11 * Implementation of the IModuleLifeCycleHandler interface.
12 * <br>This default implementation may be inherited by the module developers in order to simplify the code writing of the module life cycle handler .
13 */
14public class JUnitLifeCycleHandler extends DefaultModuleLifeCycleHandler {
15
16 /**
17 * Constructor.
18 * @param module the Module this life cycle handler is instanciated for.
19 */
20 public JUnitLifeCycleHandler(JUnitModule module) {
21 super(module);
22 }
23
24 /**
25 * @see org.modelio.api.module.DefaultModuleLifeCycleHandler#start()
26 */
27 @Override
28 public boolean start() throws ModuleException {
29 // get the version of the module
30 Version moduleVersion = this.module.getVersion();
31
32 // get the Modelio log service
33 ILogService logService = this.module.getModuleContext().getLogService();
34
35 String message = "Start of " + this.module.getName() + " " + moduleVersion;
36 logService.info(message);
37 return super.start();
38 }
39
40 /**
41 * @see org.modelio.api.module.DefaultModuleLifeCycleHandler#stop()
42 */
43 @Override
44 public void stop() throws ModuleException {
45 super.stop();
46 }
47
48 public static boolean install(String modelioPath, String mdaPath) throws ModuleException {
49 return DefaultModuleLifeCycleHandler.install(modelioPath, mdaPath);
50 }
51
52 /**
53 * @see org.modelio.api.module.DefaultModuleLifeCycleHandler#select()
54 */
55 @Override
56 public boolean select() throws ModuleException {
57 return super.select();
58 }
59
60 /**
61 * @see org.modelio.api.module.DefaultModuleLifeCycleHandler#unselect()
62 */
63 @Override
64 public void unselect() throws ModuleException {
65 super.unselect();
66 }
67
68 /**
69 * @see org.modelio.api.module.DefaultModuleLifeCycleHandler#upgrade(org.modelio.api.modelio.Version, java.util.Map)
70 */
71 @Override
72 public void upgrade(Version oldVersion, Map<String, String> oldParameters) throws ModuleException {
73 super.upgrade(oldVersion, oldParameters);
74 }
75}
76
Clone this wiki locally |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |