当前位置: 首页>>代码示例>>Java>>正文


Java DataTable.asMap方法代码示例

本文整理汇总了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));
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:21,代码来源:FolderStep.java

示例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();
}
 
开发者ID:tomitribe,项目名称:beryllium,代码行数:9,代码来源:RedisScoredMembersSteps.java

示例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());
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:16,代码来源:DatasetStep.java

示例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));
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:10,代码来源:PreparationStep.java

示例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);
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:12,代码来源:PreparationStep.java

示例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);
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:13,代码来源:PreparationStep.java

示例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);
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:9,代码来源:ActionStep.java

示例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());
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:14,代码来源:ActionStep.java

示例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);
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:15,代码来源:ActionStep.java

示例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);
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:16,代码来源:ActionStep.java

示例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);
}
 
开发者ID:Talend,项目名称:data-prep,代码行数:13,代码来源:ExportPreparationStep.java

示例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);
}
 
开发者ID:cchacin,项目名称:cucumber-common-steps,代码行数:8,代码来源:RedisScoredMembersSteps.java


注:本文中的cucumber.api.DataTable.asMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。