use of gherkin.formatter.model.DataTableRow in project alien4cloud by alien4cloud.
the class EditorStepDefs method i_execute_the_operation_on_topology_number.
@Given("^I execute the operation on the topology number (\\d+)$")
public void i_execute_the_operation_on_topology_number(int indexOfTopologyId, DataTable operationDT) throws Throwable {
Map<String, String> operationMap = Maps.newHashMap();
for (DataTableRow row : operationDT.getGherkinRows()) {
operationMap.put(row.getCells().get(0), row.getCells().get(1));
}
Class operationClass = Class.forName(operationMap.get("type"));
AbstractEditorOperation operation = (AbstractEditorOperation) operationClass.newInstance();
EvaluationContext operationContext = new StandardEvaluationContext(operation);
SpelParserConfiguration config = new SpelParserConfiguration(true, true);
SpelExpressionParser parser = new SpelExpressionParser(config);
for (Map.Entry<String, String> operationEntry : operationMap.entrySet()) {
if (!"type".equals(operationEntry.getKey())) {
parser.parseRaw(operationEntry.getKey()).setValue(operationContext, getValue(operationEntry.getValue()));
}
}
doExecuteOperation(operation, topologyIds.get(indexOfTopologyId));
}
Aggregations