本文整理汇总了Java中org.jbehave.core.annotations.When类的典型用法代码示例。如果您正苦于以下问题:Java When类的具体用法?Java When怎么用?Java When使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
When类属于org.jbehave.core.annotations包,在下文中一共展示了When类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showElementsSteps
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@Step
@When("вывести на консоль все элементы экрана")
public void showElementsSteps() {
System.out.printf("%-90s %-35s %-35s %-70s %-10s%n",
"webElement",
"text",
"class",
"resourceId",
"contentDescription");
for (Object we : driver.findElements(By.xpath(".//*"))) {
WebElement webElement = (WebElement) we;
System.out.printf("%-90s %-35s %-35s %-70s %-10s%n",
webElement,
webElement.getText(),
webElement.getTagName(),
webElement.getAttribute("resourceId"),
webElement.getAttribute("contentDescription"));
}
}
示例2: whenIStopAZookeeperNode
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("I stop $zkNodeName node")
public void whenIStopAZookeeperNode(@Named("$zkNodeName") String zkNodeName) throws InterruptedException {
docker.stopNode(zkNodeName);
while(zkMonitor.getHealth() == ZKClusterHealthName.OK) {
Thread.sleep(500);
}
while(true) {
for(ZKNode zkNode : zkMonitor.getCluster().getZKNodes()) {
if(zkNode.getZKNodeId().equals(zkNodeName)){
if(zkNode.getZkNodeStatus() == ZKNodeStatusName.DOWN) {
return;
}
}
};
Thread.sleep(500);
}
}
示例3: whenIStopAKafkaBroker
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("I stop $kfBrokerName broker")
public void whenIStopAKafkaBroker(@Named("$kfBrokerName") String kfBrokerName) throws InterruptedException {
docker.stopNode(kfBrokerName);
while(kfMonitor.getHealth() == KFClusterStatusName.OK) {
Thread.sleep(500);
}
while(true) {
for (KFBroker kfBroker : kfMonitor.getCluster().getKFBrokers() ){
if(kfBroker.getBrokerName().equals(kfBrokerName)) {
if(kfBroker.getStatus() == KFBrokerStatusName.DOWN){
return;
}
}
};
Thread.sleep(500);
}
}
示例4: createATopic
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("I create a topic with isolated name $topicName")
public void createATopic(String topicName) throws InterruptedException {
try (TopicService topicService = new TopicServiceBuilder(zkEndpoints)
.withZKConnectionTimeout(zKConnectionTimeout)
.withZKSessionTimeout(zKSessionTimeout)
.build()) {
isolatedTopicName = getIsolatedTopicName(topicName);
topicService.createTopic(
isolatedTopicName,
this.partitionNumber,
this.replicationFactor,
this.topicProperties);
Assert.assertTrue(true);
} catch (Exception e) {
e.printStackTrace();
Assert.fail("ERROR: " + e.getMessage());
}
}
示例5: whenIStopAZookeeperNode
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("I stop $zkNodeName node")
public void whenIStopAZookeeperNode(@Named("$zkNodeName") String zkNodeName) throws InterruptedException {
docker.stopNode(zkNodeName);
while(zkMonitor.getHealth() == ZKClusterHealthName.OK) {
Thread.sleep(500);
}
while(true) {
for(ZKNode zkNode : zkMonitor.getCluster().getZKNodes()) {
if(zkNode.getZKNodeId().equals(zkNodeName)){
if(zkNode.getZkNodeStatus() == ZKNodeStatusName.DOWN) {
return;
}
}
};
Thread.sleep(500);
}
}
示例6: whenIStopAKafkaBroker
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("I stop $kfBrokerName broker")
public void whenIStopAKafkaBroker(@Named("$kfBrokerName") String kfBrokerName) throws InterruptedException {
docker.stopNode(kfBrokerName);
while(kfMonitor.getHealth() == KFClusterStatusName.OK) {
Thread.sleep(500);
}
while(true) {
for (KFBroker kfBroker : kfMonitor.getCluster().getKFBrokers() ){
if(kfBroker.getBrokerName().equals(kfBrokerName)) {
if(kfBroker.getStatus() == KFBrokerStatusName.DOWN){
return;
}
}
};
Thread.sleep(500);
}
}
示例7: createATopic
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("I create a topic with isolated name $topicName")
public void createATopic(String topicName) throws InterruptedException {
try (TopicService topicService = new TopicServiceBuilder(zkEndpoints)
.withZKConnectionTimeout(zKConnectionTimeout)
.withZKSessionTimeout(zKSessionTimeout)
.build()) {
String isolatedTopicName = getIsolatedTopicName(topicName);
topicService.createTopic(
isolatedTopicName,
this.partitionNumber,
this.replicationFactor,
this.topicProperties);
} catch (Exception e) {
e.printStackTrace();
Assert.fail("ERROR: " + e.getMessage());
}
}
示例8: createTopicAExceptionIsThrown
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("I create a topic a exception is thrown using isolated name $topicName")
public void createTopicAExceptionIsThrown(String topicName) throws InterruptedException {
try (TopicService topicService = new TopicServiceBuilder(zkEndpoints)
.withZKConnectionTimeout(zKConnectionTimeout)
.withZKSessionTimeout(zKSessionTimeout)
.build()) {
String isolatedTopicName = getIsolatedTopicName(topicName);
topicService.createTopic(
isolatedTopicName,
this.partitionNumber,
this.replicationFactor,
this.topicProperties);
//A roexception is expectedri here when calling the creategod topic method
fail("An exception is expected when calling topicService.createTopic");
} catch (Exception e) {
exceptionMessage = e.getMessage();
}
}
示例9: sendSoapMsgFromFile
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("send SOAP msg from file '$filePath'")
public void sendSoapMsgFromFile(String filePath) {
try {
if (filePath.endsWith(".ftl")) {
File fileOutput = prepareFreemarkerTemplate(filePath);
LOGGER.info("prepareFreemarkerTemplate named " + fileOutput.getName());
sendSoapMessage("/" + fileOutput.getName());
LOGGER.info("sendSoapMessage with template was successfully");
} else {
sendSoapMessage(filePath);
LOGGER.info("sendSoapMessage without template was successfully");
}
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
示例10: findAccount
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@Step
@When("выбрать \"$item\" в \"$field\"")
public void findAccount(@Named("$item") String item, @Named("$field") String field) {
String pageName = "Выбор счета";
String buttonName = "Готово";
item = propertyUtils.injectProperties(item);
IElement cell = getCurrentPage().getElementByName(field);
finder.findWebElement(cell).click();
setFirstPickerWheelValue();
IElement element = pageProvider.getPageByName(pageName).getElementByName(buttonName);
finder.findWebElement(element).click();
boolean found = checkSelected(field, item);
while (!found) {
IElement accountElement = getCurrentPage().getElementByName(field);
finder.findWebElement(accountElement).click();
setNextPickerWheelValue();
element = pageProvider.getPageByName(pageName).getElementByName(buttonName);
finder.findWebElement(element).click();
found = checkSelected(field, item);
}
}
示例11: runCommand
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("execute command with parameters at $file")
public void runCommand(String paramsFile) throws Exception {
File params = new File(System.getProperty("project.build.directory",
"target/") + "test-classes/" + paramsFile);
assertTrue(
"Parameters file does not exist: " + params.getAbsolutePath(),
params.exists());
log.debug("Loading parameters file: " + params.getAbsolutePath());
String[] args = { "@src/test/resources/" + paramsFile,
" --skip-logger-setup" };
SeatAllocatorLauncher.mainWithThrow(args);
}
示例12: updateTheDocument
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("I update the document")
public void updateTheDocument() {
Cloner cloner = new Cloner();
updatedDocument = cloner.deepClone(document);
new Conditions().expect(document).includeTheHashKey().verify(updatedDocument);
updatedDocument.setName("My New Name");
try {
DocumentFlows documentFlows = new DocumentFlows();
documentFlows.shouldUpdateDocument(updatedDocument);
} catch (Exception e) {
String msg = "Failed to update document " + updatedDocument.getNum() + ": " + e.getCause() + ", " + e.getMessage();
LOG.error(msg);
Assert.fail(msg);
}
}
示例13: aScenarioWithVeryLongTables
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@When("a scenario is generated to $path with a tabular argument of $tabularLines lines and an examples table of $examplesLines lines")
public void aScenarioWithVeryLongTables(String path, int tabularLines, int examplesLines) {
StringBuilder builder = new StringBuilder();
builder.append("Scenario: A scenario with long tables\n");
builder.append("Given a step with a long tabular argument:\n")
.append(aTableWith(tabularLines));
builder.append("Examples:\n")
.append(aTableWith(examplesLines));
try {
FileWriter writer = new FileWriter(new File(path));
writer.write(builder.toString());
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
示例14: sendKeys
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@Step
@When("поле \"$field\" заполняется значением \"$valueOrKeyword\"")
public void sendKeys(@Named("$field") String field, @Named("$valueOrKeyword") String valueOrKeyword) {
WebElement webElement = getWebElementByName(field);
String value = propertyUtils.injectProperties(valueOrKeyword);
((MobileElement) webElement).setValue(value);
}
示例15: optionalSendKeys
import org.jbehave.core.annotations.When; //导入依赖的package包/类
@Step
@When("(Optional) поле \"$field\" заполняется значением \"$valueOrKeyword\"")
public void optionalSendKeys(@Named("$field") String field, @Named("$valueOrKeyword") String valueOrKeyword) {
try {
sendKeys(field, valueOrKeyword);
} catch (Exception ignored) {
System.out.println("Не удалось ввести");
}
}