本文整理汇总了Java中cucumber.api.DataTable.asMap方法的典型用法代码示例。如果您正苦于以下问题:Java DataTable.asMap方法的具体用法?Java DataTable.asMap怎么用?Java DataTable.asMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cucumber.api.DataTable
的用法示例。
在下文中一共展示了DataTable.asMap方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFolder
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Then("^I create a folder with the following parameters :$")
public void createFolder(@NotNull DataTable dataTable) throws IOException {
Map<String, String> params = dataTable.asMap(String.class, String.class);
String parentFolderName = params.get(ORIGIN);
String folder = params.get(FOLDER_NAME);
List<Folder> folders = folderUtil.listFolders();
Folder parentFolder = folderUtil.extractFolder(parentFolderName, folders);
Assert.assertNotNull(parentFolder);
Response response = api.createFolder(parentFolder.id, folder);
response.then().statusCode(200);
final String content = IOUtils.toString(response.getBody().asInputStream(), StandardCharsets.UTF_8);
Folder createdFolder = objectMapper.readValue(content, Folder.class);
Assert.assertEquals(createdFolder.path, "/" + folder);
folders = folderUtil.listFolders();
Set<Folder> splittedFolders = util.splitFolder(createdFolder, folders);
splittedFolders.forEach(f -> context.storeFolder(f));
}
示例2: db
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Given("^I have the redis scored members \"([^\"]*)\"(?: in the db (\\d+))? with values:$")
public void iHaveTheRedisScoredMembersInTheDbWithValuesColon(final String key,
final int database, final DataTable dataTable) {
final Map<String, Double> table = dataTable.asMap(String.class, Double.class);
final Jedis jedis = RedisUtil.getJedis(database);
jedis.zadd(key, table);
jedis.close();
}
示例3: existDataset
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Given("^A dataset with the following parameters exists :$") //
public void existDataset(DataTable dataTable) throws IOException {
Map<String, String> params = dataTable.asMap(String.class, String.class);
Response response = api.listDatasetDetails();
response.then().statusCode(200);
final String content = IOUtils.toString(response.getBody().asInputStream(), StandardCharsets.UTF_8);
List<DatasetMeta> datasetMetas = objectMapper.readValue(content, new TypeReference<List<DatasetMeta>>() {
});
Assert.assertEquals(1, //
datasetMetas.stream() //
.filter(d -> (suffixName(params.get(DATASET_NAME))).equals(d.name) //
&& params.get(NB_ROW).equals(d.records)) //
.count());
}
示例4: checkPreparation
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Given("^A preparation with the following parameters exists :$")
public void checkPreparation(DataTable dataTable) {
Map<String, String> params = dataTable.asMap(String.class, String.class);
String prepId = context.getPreparationId(suffixName(params.get(PREPARATION_NAME)));
PreparationDetails prepDet = getPreparationDetails(prepId);
Assert.assertNotNull(prepDet);
Assert.assertEquals(prepDet.dataset.dataSetName, suffixName(params.get(DATASET_NAME)));
Assert.assertEquals(Integer.toString(prepDet.steps.size() - 1), params.get(NB_STEPS));
}
示例5: movePreparation
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Then("^I move the preparation \"(.*)\" with the following parameters :$")
public void movePreparation(String preparationName, DataTable dataTable) throws IOException {
Map<String, String> params = dataTable.asMap(String.class, String.class);
List<Folder> folders = folderUtil.listFolders();
Folder originFolder = folderUtil.extractFolder(params.get(ORIGIN), folders);
Folder destFolder = folderUtil.extractFolder(params.get(DESTINATION), folders);
String prepId = context.getPreparationId(suffixName(preparationName));
Response response = api.movePreparation(prepId, originFolder.id, destFolder.id,
suffixName(params.get(NEW_PREPARATION_NAME)));
response.then().statusCode(200);
}
示例6: copyPreparation
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Then("^I copy the preparation \"(.*)\" with the following parameters :$")
public void copyPreparation(String preparationName, DataTable dataTable) throws IOException {
Map<String, String> params = dataTable.asMap(String.class, String.class);
String suffixedPreparationName = suffixName(params.get(NEW_PREPARATION_NAME));
List<Folder> folders = folderUtil.listFolders();
Folder destFolder = folderUtil.extractFolder(params.get(DESTINATION), folders);
String prepId = context.getPreparationId(suffixName(preparationName));
String newPreparationId = api.copyPreparation(prepId, destFolder.id, suffixedPreparationName).then().statusCode(200)
.extract().body().asString();
context.storePreparationRef(newPreparationId, suffixedPreparationName);
}
示例7: whenIAddAStepToAPreparation
import cucumber.api.DataTable; //导入方法依赖的package包/类
@When("^I add a step with parameters :$")
public void whenIAddAStepToAPreparation(DataTable dataTable) {
Map<String, String> params = dataTable.asMap(String.class, String.class);
String prepId = context.getPreparationId(suffixName(params.get(PREPARATION_NAME)));
Action action = new Action();
util.mapParamsToAction(params, action);
api.addAction(prepId, action);
}
示例8: existStep
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Deprecated
@Given("^A step with the following parameters exists on the preparation \"(.*)\" :$") //
public void existStep(String preparationName, DataTable dataTable) throws IOException {
Map<String, String> params = dataTable.asMap(String.class, String.class);
String prepId = context.getPreparationId(preparationName);
PreparationDetails prepDet = getPreparationDetails(prepId);
List<Action> actions = prepDet.actions.stream() //
.filter(action -> action.action.equals(params.get(ACTION_NAME))) //
.filter(action -> action.parameters.get(COLUMN_ID).equals(params.get(COLUMN_ID.getName()))) //
.filter(action -> action.parameters.get(COLUMN_NAME).equals(params.get(COLUMN_NAME.getName()))) //
.collect(Collectors.toList());
Assert.assertEquals(1, actions.size());
}
示例9: updateStep
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Then("^I update the first step like \"(.*)\" on the preparation \"(.*)\" with the following parameters :$")
public void updateStep(String stepName, String prepName, DataTable dataTable) throws IOException {
Map<String, String> params = dataTable.asMap(String.class, String.class);
String prepId = context.getPreparationId(suffixName(prepName));
Action storedAction = context.getAction(stepName);
Assert.assertTrue(storedAction != null);
List<Action> actions = getActionsFromStoredAction(prepId, storedAction);
Assert.assertTrue(actions.size() > 0);
// update stored action parameters
util.mapParamsToAction(params, storedAction);
storedAction.id = actions.get(0).id;
Response response = api.updateAction(prepId, storedAction.id, storedAction);
response.then().statusCode(200);
}
示例10: updateFirstActionFoundWithName
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Given("I update the first action with name \"(.*)\" on the preparation \"(.*)\" with the following parameters :")
public void updateFirstActionFoundWithName(String actionName, String prepName, DataTable dataTable) throws IOException {
Map<String, String> params = dataTable.asMap(String.class, String.class);
String prepId = context.getPreparationId(suffixName(prepName));
Action foundAction = getFirstActionWithName(prepId, actionName);
Assert.assertTrue(foundAction != null);
// Update action
Action action = new Action();
action.action = actionName;
action.id = foundAction.id;
action.parameters = foundAction.parameters.clone();
util.mapParamsToAction(params, action);
Response response = api.updateAction(prepId, action.id, action);
response.then().statusCode(200);
}
示例11: whenIExportThePreparationWithCustomParametersInto
import cucumber.api.DataTable; //导入方法依赖的package包/类
@When("^I export the preparation with parameters :$")
public void whenIExportThePreparationWithCustomParametersInto(DataTable dataTable) throws IOException {
Map<String, String> params = dataTable.asMap(String.class, String.class);
ExportType exportType = epAnalyzer.detectExportType(params);
ExportSampleStep exporter = epAnalyzer.getExporter(exportType);
if (exporter == null) {
Assert.fail("No exporter available for " + exportType.getName() + " export type.");
}
exporter.exportSample(params);
}
示例12: db
import cucumber.api.DataTable; //导入方法依赖的package包/类
@Given("^I have the redis scored members \"([^\"]*)\"(?: in the db (\\d+))? with values:$")
public void I_have_the_redis_scored_members_in_the_db_with_values(final String key,
final int database, final DataTable dataTable) {
final Map<String, Double> table = dataTable.asMap(String.class, Double.class);
jedis.select(database);
jedis.zadd(key, table);
}