blob: 49addf3a90a3163f4eed5683c9bd8c322efe3845 (
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
|
<%@ jet
package="org.eclipse.jubula.toolkit.api.gen"
imports="java.util.*
org.eclipse.jubula.toolkit.api.gen.internal.ClassGenerator
org.eclipse.jubula.toolkit.api.gen.internal.NameMappingLoader
org.eclipse.jubula.tools.xml.businessmodell.*"
class="ComponentGenerator"%>
<%
Component component = (Component)argument;
NameMappingLoader nameLoader = NameMappingLoader.getInstance();
List<Action> actions = component.getActions();
String[] splitName = ClassGenerator.splitName(component.getType());
String path = nameLoader.getDesiredName(splitName[0]);
String name = nameLoader.getDesiredName(splitName[1]);
List<String> realizedTypes = component.getRealizedTypes();
String realizedType = realizedTypes.size() > 0 ? realizedTypes.get(0) : null;
String testerClass = "";
if (component instanceof ConcreteComponent) {
testerClass = ((ConcreteComponent)component).getTesterClass();
}
%>
/*******************************************************************************
* Copyright (c) 2014 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
*******************************************************************************/
package <%="org.eclipse.jubula.toolkit.base.internal." + path%>;
import org.eclipse.jubula.toolkit.base.api.internal.annotations.RealizedType;
import org.eclipse.jubula.toolkit.base.api.internal.annotations.TesterClass;
@RealizedType(realizedType="<%=realizedType%>")
@TesterClass(testerClass="<%=testerClass%>")
public class <%=name%> {
Object m_component;
public <%=name%>(Object component) {
m_component = component;
}
<%
Iterator<Action> actionsIterator = actions.iterator();
while (actionsIterator.hasNext()) {
Action action = actionsIterator.next();
String actionName = nameLoader.getDesiredName(action.getMethod());
List<Param> params = action.getParams();
%>
<%if (action.isDeprecated()) {%>@Deprecated<%}%>
public void <%=actionName%>(
<%
Iterator<Param> paramIterator = params.iterator();
while (paramIterator.hasNext()) {
Param param = paramIterator.next();
String paramType = nameLoader.getDesiredName(param.getType());
String paramName = nameLoader.getDesiredName(param.getName().replace(".",""));
%>
<%=paramType%> <%=paramName%><%if(paramIterator.hasNext()){%>,<%}%>
<%
}
%>
) {
}
<%
}
%>
}
|