本文整理汇总了Java中org.jbehave.core.annotations.Named类的典型用法代码示例。如果您正苦于以下问题:Java Named类的具体用法?Java Named怎么用?Java Named使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Named类属于org.jbehave.core.annotations包,在下文中一共展示了Named类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: whenIStopAZookeeperNode
import org.jbehave.core.annotations.Named; //导入依赖的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);
}
}
示例2: IReceiveTheClusterAndItsStatus
import org.jbehave.core.annotations.Named; //导入依赖的package包/类
@Then("Kafka cluster status is $status")
public void IReceiveTheClusterAndItsStatus(@Named("$status") String status) throws InterruptedException {
switch (status) {
case "OK":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.OK) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.OK);
break;
case "WARNING":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.WARNING) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.WARNING);
break;
case "DOWN":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.DOWN) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.DOWN);
break;
default:
break;
}
}
示例3: whenIStopAKafkaBroker
import org.jbehave.core.annotations.Named; //导入依赖的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: whenIStopAZookeeperNode
import org.jbehave.core.annotations.Named; //导入依赖的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);
}
}
示例5: whenIStopAKafkaBroker
import org.jbehave.core.annotations.Named; //导入依赖的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);
}
}
示例6: IReceiveTheClusterAndItsStatus
import org.jbehave.core.annotations.Named; //导入依赖的package包/类
@Then("Kafka cluster status is $status")
public void IReceiveTheClusterAndItsStatus(@Named("$status") String status) throws InterruptedException {
switch (status) {
case "OK":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.OK) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.OK);
break;
case "WARNING":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.WARNING) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.WARNING);
break;
case "DOWN":
while(kfMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.DOWN) {
Thread.sleep(500);
}
Assert.assertTrue(kfMonitor.getCluster().getKfClusterStatus() == KFClusterStatusName.DOWN);
break;
default:
break;
}
}
示例7: findAccount
import org.jbehave.core.annotations.Named; //导入依赖的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);
}
}
示例8: thenRuleIs
import org.jbehave.core.annotations.Named; //导入依赖的package包/类
@Then("rule $rule is:$value")
public void thenRuleIs(@Named("rule") String rule, @Named("value") String value) {
Queue<Node> queue = new LinkedBlockingQueue<>(nodes);
while (!queue.isEmpty()) {
Node node = queue.poll();
if (node instanceof Rule) {
Rule r = (Rule) node;
if (r.getFullName().equals(rule)) {
String expected = value.trim();
String given = r.getValue().accept(pv, null).trim();
Assert.assertEquals(expected, given);
return;
}
} else if (node instanceof Ruleset) {
queue.add(((Ruleset) node).getBlock());
} else if (node instanceof Block) {
queue.addAll(((Block) node).getNodes());
}
}
Assert.fail(String.format("Rule %s not found", rule));
}
示例9: thenColorAsHex
import org.jbehave.core.annotations.Named; //导入依赖的package包/类
@Then("color $rule as hex is:$value")
public void thenColorAsHex(@Named("rule") String rule, @Named("value") String value) {
Queue<Node> queue = new LinkedBlockingQueue<>(nodes);
while (!queue.isEmpty()) {
Node node = queue.poll();
if (node instanceof Rule) {
Rule r = (Rule) node;
if (r.getFullName().equals(rule)) {
Literal literal = r.getValue().accept(new EvaluateVisitor(), null);
if (literal.type() == NodeType.COLOR) {
Color color = (Color) literal;
String expected = value.trim();
String given = String.format("#%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue());
Assert.assertEquals(expected, given);
return;
}
}
} else if (node instanceof Ruleset) {
queue.add(((Ruleset) node).getBlock());
} else if (node instanceof Block) {
queue.addAll(((Block) node).getNodes());
}
}
Assert.fail(String.format("Color %s not found", rule));
}
示例10: thenRulesetContainsClasses
import org.jbehave.core.annotations.Named; //导入依赖的package包/类
@Then("ruleset $num contains classes:$classes")
public void thenRulesetContainsClasses(@Named("num") int num, @Named("classes") String classes) {
Ruleset ruleset = getRulesetByNum(num);
Assert.assertNotNull(String.format("Ruleset %d not found", num), ruleset);
StringBuilder sb = new StringBuilder();
for (Selector selector : ruleset.getSelectors()) {
for (Element element : selector.getElements()) {
if (element.getType() == Element.ElementType.CLASS) {
sb.append(element.accept(pv, null));
sb.append(", ");
}
}
}
sb.setLength(sb.length() - 2);
Assert.assertEquals(classes.trim(), sb.toString());
}
示例11: thenRulesetContainsIds
import org.jbehave.core.annotations.Named; //导入依赖的package包/类
@Then("ruleset $num contains ids:$ids")
public void thenRulesetContainsIds(@Named("num") int num, @Named("ids") String ids) {
Ruleset ruleset = getRulesetByNum(num);
Assert.assertNotNull(String.format("Ruleset %d not found", num), ruleset);
StringBuilder sb = new StringBuilder();
for (Selector selector : ruleset.getSelectors()) {
for (Element element : selector.getElements()) {
if (element.getType() == Element.ElementType.ID) {
sb.append(element.accept(pv, null));
sb.append(", ");
}
}
}
sb.setLength(sb.length() - 2);
Assert.assertEquals(ids.trim(), sb.toString());
}
示例12: pageLoaded
import org.jbehave.core.annotations.Named; //导入依赖的package包/类
@Step
@Then("загружена страница \"$screenName\"")
public void pageLoaded(@Named("$screenName") String screenName) {
List<IElement> elements = pageProvider.getPageByName(screenName).getSpecificElements();
for (IElement element : elements) {
WebElement webElement = finder.findWebElement(element);
if (webElement == null)
throw new PageNoLoadException(screenName);
}
testContext.setCurrentPageName(screenName);
}
示例13: optionalPageLoaded
import org.jbehave.core.annotations.Named; //导入依赖的package包/类
@Step
@Then("(Optional) загружена страница \"$screenName\"")
public void optionalPageLoaded(@Named("$screenName") String screenName) {
try {
pageLoaded(screenName);
} catch (Exception ignored) {
}
}
示例14: checkElement
import org.jbehave.core.annotations.Named; //导入依赖的package包/类
@Step
@Then("на экране есть \"$elementName\"")
public void checkElement(@Named("$elementName") String elementName) {
WebElement webElement = getWebElementByName(elementName);
if (webElement == null) {
throw new ElementNotFoundException(elementName, getCurrentPage().getName());
}
}
示例15: sendKeys
import org.jbehave.core.annotations.Named; //导入依赖的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);
}