Skip to main content
summaryrefslogtreecommitdiffstats
blob: 67c9c5c98eab10533e8991f9ee516b5ca4021eb2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
/*******************************************************************************
 * Copyright (c) 2016 BREDEX GmbH.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     BREDEX GmbH - initial API and implementation and/or initial documentation
 *******************************************************************************/
RobotTask {
    variables = {
        ## Name of the project
        STRING "BundleProject_projectName" default "",
        ## Symbolic id of the bundle
        STRING "BundleProject_ID" default "",
        ## Name of the bundle
        STRING "BundleProject_name" default "",
        ## Vendor of the bundle
        STRING "BundleProject_vendor" default "",
        ## Bundle version
        STRING "BundleProject_version" default "",
        ## Execution Environment
        STRING "BundleProject_executionEnvironment" default "",
        ## The name of the component's class
        STRING "ComponentName" default "",
        ## The component's fully qualified name
        STRING "ComponentQualifier" default "",
        ## The component type's class
        STRING "ComponentTypeName" default "",
        ## The component type's qualifier
        STRING "ComponentTypeQualifier" default "",
        ## The super class
        STRING "SuperClassQualifier" default "",
        ## The super class name
        STRING "SuperClassName" default "",
        ## The realizer
        STRING "Realizer" default "guidancer.abstract.Widget",
        ## The tester class
        STRING "TesterClassName" default "",
        ## Tester Class methods
        STRING "Methods" default "",
        ## i18n.properties content
        STRING "i18n" default "",
        ## ComponentConfiguration.xml actions
        STRING "Actions" default "",
        ## The type of the toolkitComponent within the ComponentConfiguration.xml
        STRING "ToolkitComponentType" default "",
        ## The dependency of the toolkit
        STRING "ToolkitDependency" default "",
        ## The toolkit expansion's name
        STRING "ToolkitExtensionName" default "",
        ## The fragment host
        STRING "FragmentHost" default "",
        ## The toolkit's name
        STRING "ToolkitName" default "",
        ## The new adapter statement
        STRING "Adapter" default "",
        ## The adapter's package
        STRING "AdapterPackage" default "",
        ## Additional Imports for e. g. JavaFX
        STRING "AdditionalImports" default ""
    }
    projects = {
        BundleProject "${BundleProject_projectName}.toolkit" {
            manifest = lazy singleton ManifestFile "${BundleProject_ID}.toolkit" "${BundleProject_version}" "${BundleProject_executionEnvironment}" {
                bundlename = "${BundleProject_name} - Toolkit\nBundle-Activator: ${BundleProject_ID}.toolkit.Activator"
                vendor = "${BundleProject_vendor}"
                requiredBundles = {
                    'org.eclipse.core.runtime',
                    'org.eclipse.jubula.tools',
                    'org.eclipse.jubula.toolkit.common',
                    'org.eclipse.swt'
                }
            }
            build = BuildProperties {
                binIncludes = {
                    "resources"
                }
            }
            pluginxml = PluginXMLFile {
                extensions = {
                    "org.eclipse.jubula.toolkit.common.toolkitsupport" {
                        elements = {
                            "toolkit" {
                                attributes = {
                                    {"IToolkitProvider", "${BundleProject_ID}.toolkit.provider.MyToolkitProvider"},
                                    {"depends", "${ToolkitDependency}"},
                                    {"includes", "null"},
                                    {"isUserToolkit", "true"},
                                    {"level", "toolkit"},
                                    {"name", "${ToolkitExtensionName}"},
                                    {"order", "20"},
                                    {"toolkitID", "${BundleProject_ID}.toolkit"}
                                }
                            }
                        }
                    }
                }
            }
            resources = {
                Folder "resources" {
                    children = {
                        Folder "xml" {
                            children = {
                                DataFile "ComponentConfiguration.xml" {
                                    content =
'<?xml version="1.0" encoding="ISO-8859-1"?>

<compSystem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../org.eclipse.jubula.toolkit.common/resources/xml/ToolkitComponentConfiguration.xsd">
    <configVersion>
        <majorVersion>1</majorVersion>
        <minorVersion>36</minorVersion>
    </configVersion>
    <toolkitComponent type="${ToolkitComponentType}" visible="true">
        <realizes>${Realizer}</realizes>
        <testerClass>${BundleProject_ID}.rc.${ToolkitName}.tester.${TesterClassName}</testerClass>
        <componentClass name="${ComponentQualifier}" />
${Actions}
    </toolkitComponent>
</compSystem>'
                                }
                            }
                        }
                    }
                },
                Folder "src"
            }
            rootfragments = {
                fragment "fragment name" "src"
            }
            compilation-units = {
                "${BundleProject_ID}.toolkit.i18n" in "fragment name" {
                    DataFile "i18n.properties" {
                        content = 
'${i18n}'
                    }
                },
                "${BundleProject_ID}.toolkit.provider" in "fragment name" {
                    DataFile "MyToolkitProvider.java" {
                        content = 
'package ${BundleProject_ID}.toolkit.provider;

import java.net.URL;
import java.util.ResourceBundle;

import ${BundleProject_ID}.toolkit.Activator;
import org.eclipse.jubula.toolkit.common.AbstractToolkitProvider;
import org.eclipse.jubula.toolkit.common.utils.ToolkitUtils;

public class MyToolkitProvider extends AbstractToolkitProvider {
    /** the bundle location */
    public static final String BUNDLE = "${BundleProject_ID}.toolkit.i18n.i18n"; //$NON-NLS-1$

    /** {@inheritDoc} */
    public URL getComponentConfigurationFileURL() {
        return ToolkitUtils.getURL(Activator.getDefault().getBundle(),
                COMP_CONFIG_PATH);
    }
    
    /** {@inheritDoc} */
    public ResourceBundle getResourceBundle() {
        return ResourceBundle.getBundle(BUNDLE);
    }
}'
                    }
                },
                "${BundleProject_ID}.toolkit" in "fragment name" {
                    DataFile "Activator.java" {
                        content =
'package ${BundleProject_ID}.toolkit;

import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;

/**
 * The activator class controls the plug-in life cycle
 */
public class Activator extends Plugin {

    /** The plug-in ID */
    public static final String PLUGIN_ID = "${BundleProject_ID}.toolkit"; //$NON-NLS-1$

    /** The shared instance */
    private static Activator plugin;

    /**
     * The constructor
     */
    public Activator() {
        plugin = this;
    }

    /**
     * {@inheritDoc}
     */
    public void start(BundleContext context) throws Exception {
        super.start(context);
    }

    /**
     * {@inheritDoc}
     */
    public void stop(BundleContext context) throws Exception {
        plugin = null;
        super.stop(context);
    }

    /**
     * Returns the shared instance
     * 
     * @return the shared instance
     */
    public static Activator getDefault() {
        return plugin;
    }

}'
                    }
                }
            }
        },
        BundleProject "${BundleProject_projectName}.rc" {
            manifest =
                ManifestFile "${BundleProject_ID}" "${BundleProject_version}" "${BundleProject_executionEnvironment}" {
                    /* Da RRobot die Angabe des Fragment-Host nicht erlaubt, wurde die 
                     * Definition mittels Zeilenumbruch an den Bundlenamen angehangen. */
                    bundlename = "${BundleProject_name} - RC\nFragment-Host: ${FragmentHost}"
                    vendor = "${BundleProject_vendor}"
                }
            build = BuildProperties {
            }
            resources = {
                Folder "src"
            }
            rootfragments = {
                fragment "source fragment" "src"
            }
            compilation-units = {
                "${BundleProject_ID}.rc.${ToolkitName}.tester" in "source fragment" {
                    DataFile "${TesterClassName}.java" {
                        content =
'package ${BundleProject_ID}.rc.${ToolkitName}.tester;

import ${ComponentQualifier};
import ${SuperClassQualifier};

/**
 * Tester Class for the AUT-Agent. This class realizes the technical access to
 * provide testability for the selected component type.<br/>
 * The following methods / classes can be quite handy for your actions:<br/>
 * - <code>getRobot()</code> returns the Robot that offers several methods for 
 *              mouse interactions
 * - <code>Verifier</code> handles comparisons for expected and actual values 
 *            and automatically gives the result to Jubula, so your method
 *            does not need a return value<br/><br/>
 * For further information about these methods / classes have a look at their
 * javaDoc documentation and at the provided extension examples for each toolkit
 */
public class ${TesterClassName} extends ${SuperClassName} {
    /**
     * @return the casted instance
     */
    protected ${ComponentName} get${ComponentName}() {
        return (${ComponentName}) getRealComponent();
    }

${Methods}
}'
                    }
                },
                "${BundleProject_ID}.rc.common.adapter" in "source fragment" {
                    DataFile "${ToolkitName}ExtensionAdapterFactory.java" {
                        content =
'package ${BundleProject_ID}.rc.common.adapter;

${AdditionalImports}
import ${ComponentQualifier};

import org.eclipse.jubula.rc.common.adaptable.IAdapterFactory;
import org.eclipse.jubula.rc.common.tester.adapter.interfaces.IComponent;
import ${AdapterPackage};


/**
 * Adapter Factory for new adapters. This class makes your new adapters usable
 * for testing. One factory could be used for all adapters implemented.
 * You usually do not have to modify this class at all.
 */
public class ${ToolkitName}ExtensionAdapterFactory implements IAdapterFactory {
    /** {@inheritDoc} */
    public Class[] getSupportedClasses() {
        return new Class[] { ${ComponentName}.class };
    }

    /** {@inheritDoc} */
    public Object getAdapter(Class targetedClass, Object objectToAdapt) {
        if (targetedClass.isAssignableFrom(IComponent.class)) {
            if (objectToAdapt instanceof ${ComponentName}) {
                return new ${Adapter};
            }
        }
        return null;
    }
}'
                    }
                }
            }
        },
        FeatureProject "${BundleProject_projectName}.feature" {
            feature = FeatureFile "${BundleProject_ID}.feature" {
                featurename = "${BundleProject_name} - Toolkit"
                version = "${BundleProject_version}"
                vendor = "${BundleProject_vendor}"
                description = LinkedString "" {
                    "Jubula Toolkit Extension - ${ToolkitName}"
                }
                
                copyright = LinkedString "http://copyrightlink" {
                    "CopyrightText"
                }
                
                license = LinkedString "http://licenselink" {
                    "LicenseText"
                }
                plugins = {
                    fragment "${BundleProject_ID}",
                    "${BundleProject_ID}.toolkit"
                }
            }
            resources = {
                DataFile "build.properties" {
                    content = "bin.includes = feature.xml"
                }
            }
        }
    }
}

Back to the top