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


Java DataTable.raw方法代码示例

本文整理汇总了Java中cucumber.api.DataTable.raw方法的典型用法代码示例。如果您正苦于以下问题:Java DataTable.raw方法的具体用法?Java DataTable.raw怎么用?Java DataTable.raw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cucumber.api.DataTable的用法示例。


在下文中一共展示了DataTable.raw方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: should

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Then("^I should(?: also)? see multiple \"([^\"]+)\" with:")
public void iShouldSeeMultipleItemsOf(String pageElementName, final DataTable elementItems) throws Throwable  {
    int i = 0;

    for (List<String> elementItem : elementItems.raw()) {
        WebElement pageElement = sitePage.findPageElement(pageElementName, i++);
        assertThat("I should find page element: " + pageElementName,
            pageElement, is(notNullValue()));

        String expectedItemText = elementItem.get(0);

        assertThat("Page element " + pageElementName + " contain item with text: " + expectedItemText,
            getElementText(pageElement),
            getMatcherForText(expectedItemText));
    }
}
 
开发者ID:NHS-digital-website,项目名称:hippo,代码行数:17,代码来源:SiteSteps.java

示例2: createMongoDBCollection

import cucumber.api.DataTable; //导入方法依赖的package包/类
/**
 * Create a MongoDB collection.
 *
 * @param colectionName
 * @param options
 */
public void createMongoDBCollection(String colectionName, DataTable options) {
    BasicDBObject aux = new BasicDBObject();
    // Recorremos las options para castearlas y añadirlas a la collection
    List<List<String>> rowsOp = options.raw();
    for (int i = 0; i < rowsOp.size(); i++) {
        List<String> rowOp = rowsOp.get(i);
        if (rowOp.get(0).equals("size") || rowOp.get(0).equals("max")) {
            int intproperty = Integer.parseInt(rowOp.get(1));
            aux.append(rowOp.get(0), intproperty);
        } else {
            Boolean boolProperty = Boolean.parseBoolean(rowOp.get(1));
            aux.append(rowOp.get(0), boolProperty);
        }
    }
    dataBase.createCollection(colectionName, aux);
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:23,代码来源:MongoDBUtils.java

示例3: resultsMustBeElasticsearch

import cucumber.api.DataTable; //导入方法依赖的package包/类
/**
 * Checks the different results of a previous query to Elasticsearch database
 *
 * @param expectedResults A DataTable Object with all data needed for check the results. The DataTable must contains at least 2 columns:
 *                        a) A field column from the result
 *                        b) Occurrences column (Integer type)
 *                        <p>
 *                        Example:
 *                        |latitude| longitude|place     |occurrences|
 *                        |12.5    |12.7      |Valencia  |1           |
 *                        |2.5     | 2.6      |Stratio   |0           |
 *                        |12.5    |13.7      |Sevilla   |1           |
 *                        IMPORTANT: All columns must exist
 * @throws Exception exception
 */
public void resultsMustBeElasticsearch(DataTable expectedResults) throws Exception {
    if (getElasticsearchResults() != null) {
        List<List<String>> expectedResultList = expectedResults.raw();
        //Check size
        assertThat(expectedResultList.size() - 1).overridingErrorMessage(
                "Expected number of columns to be" + (expectedResultList.size() - 1)
                        + "but was " + previousElasticsearchResults.size())
                .isEqualTo(previousElasticsearchResults.size());
        List<String> columnNames = expectedResultList.get(0);
        for (int i = 0; i < previousElasticsearchResults.size(); i++) {
            for (int j = 0; j < columnNames.size(); j++) {
                assertThat(expectedResultList.get(i + 1).get(j)).overridingErrorMessage("In row " + i + "and "
                        + "column " + j
                        + "have "
                        + "been "
                        + "found "
                        + expectedResultList.get(i + 1).get(j) + " results and " + previousElasticsearchResults.get(i).get(columnNames.get(j)).toString() + " were "
                        + "expected").isEqualTo(previousElasticsearchResults.get(i).get(columnNames.get(j)).toString());
            }
        }
    } else {
        throw new Exception("You must execute a query before trying to get results");
    }
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:40,代码来源:CommonG.java

示例4: assertStreamColumns

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Then("^the stream '(.*?)' has this columns \\(with name and type\\):$")
public void assertStreamColumns(String streamName, DataTable data)
        throws StratioEngineOperationException {
    commonspec.getLogger().info("Verifying stream columns");

    List<ColumnNameTypeValue> columns = commonspec.getStratioStreamingAPI()
            .columnsFromStream(streamName);

    List<ColumnNameTypeValue> expectedColumns = new ArrayList<ColumnNameTypeValue>();
    for (List<String> row : data.raw()) {
        ColumnNameTypeValue expectedCol = new ColumnNameTypeValue(
                row.get(0), ColumnType.valueOf(row.get(1).toUpperCase()),
                null);
        expectedColumns.add(expectedCol);
    }

    assertThat(commonspec.getStratioStreamingAPI().columnsFromStream(streamName))
            .as("Unexpected column count at stream " + streamName).hasSize(data.raw().size());

    assertThat(columns).as("Unexpected columns at stream " + streamName).isEqualTo(expectedColumns);
}
 
开发者ID:Stratio,项目名称:Decision,代码行数:22,代码来源:ThenSpec.java

示例5: insertData

import cucumber.api.DataTable; //导入方法依赖的package包/类
@When("^I insert into a stream with name '(.*?)' this data:$")
public void insertData(
        @Transform(NullableStringConverter.class) String streamName,
        DataTable table) {
    commonspec.getLogger().info("Inserting into stream {}", streamName);

    List<ColumnNameValue> streamData = new ArrayList<ColumnNameValue>();
    for (List<String> row : table.raw()) {
        ColumnNameValue columnValue = new ColumnNameValue(row.get(0),
                row.get(1));
        streamData.add(columnValue);
    }

    try {
        commonspec.getStratioStreamingAPI().insertData(streamName,
                streamData);
    } catch (Exception e) {
        commonspec.getExceptions().add(e);
        commonspec
                .getLogger()
                .info("Caught an exception whilst inserting data into the stream {} : {}",
                        streamName, e);
    }
}
 
开发者ID:Stratio,项目名称:Decision,代码行数:25,代码来源:WhenSpec.java

示例6: createConnections

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Given("^created connections$")
public void createConnections(DataTable connectionsData) {
	ConnectionSteps connectionSteps = new ConnectionSteps();
	ConnectionsListComponent connectionsListComponent = new ConnectionsListComponent();
	
	List<List<String>> dataTable = connectionsData.raw();
	
	for (List<String> dataRow : dataTable) {
		String connectionType = dataRow.get(0);
		String connectionCredentialsName = dataRow.get(1);		
		String connectionName = dataRow.get(2);
		String connectionDescription = dataRow.get(3);
		
		navigateTo("", "Connections");
		validatePage("", "Connections");

		ElementsCollection connections = connectionsListComponent.getAllConnections();
		connections = connections.filter(exactText(connectionName));

		if (connections.size() != 0) {
			log.warn("Connection {} already exists!", connectionName);
		} else {
			clickOnButton("Create Connection");

			connectionSteps.selectConnection(connectionType);
			connectionSteps.fillConnectionDetails(connectionCredentialsName);

			clickOnButton("Validate");
			successNotificationIsPresentWithError(connectionType + " has been successfully validated");

			scrollTo("top", "right");
			clickOnButton("Next");

			connectionSteps.typeConnectionName(connectionName);
			connectionSteps.typeConnectionDescription(connectionDescription);

			clickOnButton("Create");
		} 
	}
}
 
开发者ID:syndesisio,项目名称:syndesis-qe,代码行数:41,代码来源:CommonSteps.java

示例7: iShouldSeeSearchResultsWhichAlsoInclude

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Then("^I should see search results which also include:$")
public void iShouldSeeSearchResultsWhichAlsoInclude(DataTable expectedResults) throws Throwable {

    List<SearchResultWidget> actualResults = searchPage.getSearchResultWidgets();

    for (List<String> elementItem : expectedResults.raw()) {
        assertTrue("Search result includes item specified",
            actualResults.stream()
                .anyMatch(result->result.getType().equals(elementItem.get(0))
                && result.getTitle().equals(elementItem.get(1))));
    }
}
 
开发者ID:NHS-digital-website,项目名称:hippo,代码行数:13,代码来源:SearchSteps.java

示例8: with_these_values

import cucumber.api.DataTable; //导入方法依赖的package包/类
@And("^with these values:$")
public void with_these_values(DataTable expected) throws Throwable {
    Map<String, String> actuals = currentCheckedHash;

    List<List<String>> keyValues = expected.raw();
    for (List<String> keyValue : keyValues) {
        String lookupKey = keyValue.get(0);
        String expectedValue = keyValue.get(1);

        assertThat(actuals, hasEntry(lookupKey, expectedValue));
    }
}
 
开发者ID:davidmarquis,项目名称:redisq,代码行数:13,代码来源:RedisSteps.java

示例9: givenParametersAre

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Given("^parameters are:$")
public void givenParametersAre(DataTable parameters) throws Throwable {
    for (List<String> parameterRow : parameters.raw()) {
        String key = parameterRow.get(0);
        String valueString = parameterRow.get(1);
        Object value = parseParameterValue(valueString);
        ctx.setParameter(key, value);
    }
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:10,代码来源:GraphGlue.java

示例10: thenTheSideEffectsShouldBe

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Then("^the side effects should be:$")
public void thenTheSideEffectsShouldBe(DataTable table) throws Throwable {
    for (List<String> tableRow : table.raw()) {
        if (tableRow.size() == 2 && tableRow.get(0).equals("+nodes")) {
            int plusNodes = Integer.parseInt(tableRow.get(1));
            assertEquals("+nodes", plusNodes, ctx.getPlusNodeCount());
        } else if (tableRow.size() == 2 && tableRow.get(0).equals("+relationships")) {
            int plusRelationships = Integer.parseInt(tableRow.get(1));
            assertEquals("+relationships", plusRelationships, ctx.getPlusRelationshipCount());
        } else if (tableRow.size() == 2 && tableRow.get(0).equals("+labels")) {
            int plusLabels = Integer.parseInt(tableRow.get(1));
            assertEquals("+labels", plusLabels, ctx.getPlusLabelCount());
        } else if (tableRow.size() == 2 && tableRow.get(0).equals("+properties")) {
            int plusProperties = Integer.parseInt(tableRow.get(1));
            assertEquals("+properties", plusProperties, ctx.getPlusPropertyCount());
        } else if (tableRow.size() == 2 && tableRow.get(0).equals("-nodes")) {
            int minusNodes = Integer.parseInt(tableRow.get(1));
            assertEquals("-nodes", minusNodes, ctx.getMinusNodeCount());
        } else if (tableRow.size() == 2 && tableRow.get(0).equals("-relationships")) {
            int minusRelationships = Integer.parseInt(tableRow.get(1));
            assertEquals("-relationships", minusRelationships, ctx.getMinusRelationshipCount());
        } else if (tableRow.size() == 2 && tableRow.get(0).equals("-labels")) {
            int minusLabels = Integer.parseInt(tableRow.get(1));
            assertEquals("-labels", minusLabels, ctx.getMinusLabelCount());
        } else if (tableRow.size() == 2 && tableRow.get(0).equals("-properties")) {
            int minusProperties = Integer.parseInt(tableRow.get(1));
            assertEquals("-properties", minusProperties, ctx.getMinusPropertyCount());
        } else {
            fail("Unhandled side effect row: " + tableRow.stream().collect(Collectors.joining(",")));
        }
    }
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:33,代码来源:GraphGlue.java

示例11: some_mysterious_data_improver_has_put_a_file_in_the_same_directory_containing_the_following_data

import cucumber.api.DataTable; //导入方法依赖的package包/类
@Given("^some mysterious data-improver has put a file \"([^\"]*)\" in the same directory containing the following data:$")
public void some_mysterious_data_improver_has_put_a_file_in_the_same_directory_containing_the_following_data(String inputFileName, DataTable inputFileContent) throws Throwable {
	File inputFile = new File(this.workDir, inputFileName);
	try (BufferedWriter bw = new BufferedWriter(new FileWriter(inputFile))) {
		for (List<String> line:inputFileContent.raw()) {
			bw.write(StringUtils.join(line, "\t") + System.getProperty("line.separator"));
		}
	}
}
 
开发者ID:RBGKew,项目名称:Reconciliation-and-Matching-Framework,代码行数:10,代码来源:RunSimpleDedupConfig.java

示例12: responseBodyHasValues

import cucumber.api.DataTable; //导入方法依赖的package包/类
@And("^Response body has values$")
public void responseBodyHasValues(DataTable params) {
    MapArray<String, Matcher<?>> map =
        new MapArray<>(params.raw(), p -> p.get(0), p -> equalTo(p.get(1)));
    restResponse.get().assertBody(map);
}
 
开发者ID:epam,项目名称:JDI,代码行数:7,代码来源:ResponseStepsEN.java


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