Search in sources :

Example 46 with DataTableRow

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));
}
Also used : StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) SpelExpressionParser(org.springframework.expression.spel.standard.SpelExpressionParser) AbstractEditorOperation(org.alien4cloud.tosca.editor.operations.AbstractEditorOperation) EvaluationContext(org.springframework.expression.EvaluationContext) StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) Map(java.util.Map) HashMap(java.util.HashMap) DataTableRow(gherkin.formatter.model.DataTableRow) SpelParserConfiguration(org.springframework.expression.spel.SpelParserConfiguration) Given(cucumber.api.java.en.Given)

Aggregations

DataTableRow (gherkin.formatter.model.DataTableRow)46 ArrayList (java.util.ArrayList)17 Test (org.junit.Test)9 List (java.util.List)6 And (cucumber.api.java.en.And)5 DataTable (cucumber.api.DataTable)4 DocString (gherkin.formatter.model.DocString)4 Step (gherkin.formatter.model.Step)4 Given (cucumber.api.java.en.Given)3 Then (cucumber.api.java.en.Then)3 LocalizedXStreams (cucumber.runtime.xstream.LocalizedXStreams)3 ExamplesTableRow (gherkin.formatter.model.ExamplesTableRow)3 Argument (gherkin.formatter.Argument)2 Arrays.asList (java.util.Arrays.asList)2 Map (java.util.Map)2 Pair (org.activityinfo.model.util.Pair)2 Usage (alien4cloud.model.common.Usage)1 Delta (cucumber.deps.difflib.Delta)1 I18n (gherkin.I18n)1 Row (gherkin.formatter.model.Row)1