Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jubula.client.api.converter/templates/NodeGenerator.javajet')
-rw-r--r--org.eclipse.jubula.client.api.converter/templates/NodeGenerator.javajet54
1 files changed, 40 insertions, 14 deletions
diff --git a/org.eclipse.jubula.client.api.converter/templates/NodeGenerator.javajet b/org.eclipse.jubula.client.api.converter/templates/NodeGenerator.javajet
index d41454bb9..9add971c1 100644
--- a/org.eclipse.jubula.client.api.converter/templates/NodeGenerator.javajet
+++ b/org.eclipse.jubula.client.api.converter/templates/NodeGenerator.javajet
@@ -5,6 +5,7 @@ imports="java.util.*
org.eclipse.jubula.client.api.converter.exceptions.InvalidNodeNameException
org.eclipse.jubula.client.api.converter.utils.CompNameLoader
org.eclipse.jubula.client.api.converter.utils.ProjectCache
+ org.eclipse.jubula.client.api.converter.utils.ParamUtils
org.eclipse.jubula.client.api.converter.utils.Utils
org.eclipse.jubula.client.core.model.ICapPO
org.eclipse.jubula.client.core.model.IExecTestCasePO
@@ -15,6 +16,7 @@ imports="java.util.*
org.eclipse.jubula.client.core.model.ISpecTestCasePO
org.eclipse.jubula.client.core.model.ITestSuitePO
org.eclipse.jubula.client.ui.rcp.Plugin
+ org.eclipse.jubula.toolkit.api.gen.internal.utils.NameLoader
org.eclipse.jubula.toolkit.common.businessprocess.ToolkitSupportBP
org.eclipse.jubula.toolkit.common.xml.businessprocess.ComponentBuilder
org.eclipse.jubula.tools.internal.constants.StringConstants
@@ -31,8 +33,10 @@ Logger log = LoggerFactory.getLogger(NodeGenerator.class);
NodeInfo info = (NodeInfo)argument;
String className = info.getClassName();
INodePO node = info.getNode();
+Locale locale = info.getLanguage();
Iterator<INodePO> iterator = node.getNodeListIterator();
String packageBase = info.getPackageBasePath();
+NameLoader nameLoader = NameLoader.getInstance();
IProjectPO project = null;
try {
project = ProjectCache.get(node.getParentProjectId());
@@ -56,7 +60,18 @@ import org.eclipse.jubula.client.AUT;
public class <%=className%> {
- public static void execute() {
+ public static void execute(
+ <%if (node instanceof ISpecTestCasePO) {
+ ISpecTestCasePO tc = (ISpecTestCasePO) node;
+ Iterator<IParamDescriptionPO> paramIterator = tc.getParameterListIter();
+ while (paramIterator.hasNext()) {
+ IParamDescriptionPO param = paramIterator.next();
+ String paramType = nameLoader.findTypeForParameter(param.getType(), StringConstants.EMPTY);
+ String paramName = param.getName();%>
+ <%=paramType%> <%=paramName%><%if(paramIterator.hasNext()){%>,<%}%>
+ <%}%>
+ <%}%>
+ ) {
AUT aut = null;
<%while (iterator.hasNext()) {
@@ -69,16 +84,16 @@ public class <%=className%> {
boolean hasDefaultMapping = loader.get("hasDefaultMapping").equals("true");
String componentNameToCreate;
String factoryName;
+ ConcreteComponent cc = null;
+ CompSystem compSystem = ComponentBuilder.getInstance().getCompSystem();
+ Component c = compSystem.getComponentForType(componentFromCap);
+ if (c instanceof ConcreteComponent) {
+ cc = (ConcreteComponent)c;
+ }
if (hasDefaultMapping) {
String toolkitID = info.getDefaultToolkit();
factoryName = Utils.getFactoryName(toolkitID);
- ConcreteComponent cc = null;
- CompSystem compSystem = ComponentBuilder.getInstance().getCompSystem();
- Component c = compSystem.getComponentForType(componentFromCap);
- if (c instanceof ConcreteComponent) {
- cc = (ConcreteComponent)c;
- }
- ConcreteComponent componentToCreate = ToolkitSupportBP.getMostConcreteRealizingComponentInToolkit(toolkitID, cc);
+ ConcreteComponent componentToCreate = ToolkitSupportBP.getMostAbstractRealizingComponentInToolkit(toolkitID, cc);
CompNameLoader newLoader = new CompNameLoader(componentToCreate.getType());
componentNameToCreate = newLoader.get("componentTypeName");
} else {
@@ -89,11 +104,15 @@ public class <%=className%> {
aut.execute(
<%=factoryName%>.create<%=componentNameToCreate%>(<%if (!hasDefaultMapping) {%>null<%}%>)
.<%=actionName%>(
- <%Iterator<IParamDescriptionPO> paramIterator = cap.getParameterList().iterator();
- while (paramIterator.hasNext()) {
- IParamDescriptionPO param = paramIterator.next();%>
- null<%if(paramIterator.hasNext()){%>,<%}%>
- <%}%>
+ <%Iterator<IParamDescriptionPO> childParamIterator = cap.getParameterListIter();
+ while (childParamIterator.hasNext()) {
+ IParamDescriptionPO param = childParamIterator.next();
+ String paramType = param.getUniqueId();
+ String enumType = nameLoader.getEnumForParam(paramType);
+ String paramValue = ParamUtils.getValueForParam(cap, param, locale);
+ Boolean isEnum = enumType != null;%>
+ <%if (isEnum) {%><%=enumType%>.valueOf(<%}%><%=paramValue%><%if (isEnum) {%>)<%}%><%if(childParamIterator.hasNext()){%>,<%}%>
+ <%}%>
),
null);
<%} else {%>
@@ -116,7 +135,14 @@ public class <%=className%> {
log.error(e.getLocalizedMessage());
}
testCaseName = Utils.getFullyQualifiedTranslatedName(spec, packageBase, projectName);%>
- <%=testCaseName%>.execute();
+ <%=testCaseName%>.execute(
+ <%Iterator<IParamDescriptionPO> childParamIterator = exec.getParameterListIter();
+ while (childParamIterator.hasNext()) {
+ IParamDescriptionPO param = childParamIterator.next();
+ String paramValue = ParamUtils.getValueForParam(exec, param, locale);%>
+ <%=paramValue%><%if(childParamIterator.hasNext()){%>,<%}%>
+ <%}%>
+ );
<%} else if (child instanceof IRefTestSuitePO) {
IRefTestSuitePO ref = (IRefTestSuitePO)child;
ITestSuitePO testSuite = ref.getTestSuite();

Back to the top