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


Java When类代码示例

本文整理汇总了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"));
    }
}
 
开发者ID:alfa-laboratory,项目名称:colibri-ui,代码行数:20,代码来源:SystemSteps.java

示例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);
    }
 }
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:20,代码来源:ZookeeperMonitorSteps.java

示例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);
    }


}
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:21,代码来源:KafkaMonitorSteps.java

示例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());
    }
}
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:21,代码来源:CreateTopicSteps.java

示例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);
    }
}
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:20,代码来源:ZookeeperMonitorEventSteps.java

示例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);
    }
}
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:19,代码来源:KafkaMonitorEventSteps.java

示例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());
    }
}
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:18,代码来源:TopicServiceSteps.java

示例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();

    }
}
 
开发者ID:mcafee,项目名称:management-sdk-for-kafka,代码行数:20,代码来源:TopicServiceSteps.java

示例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);
    }
}
 
开发者ID:tapack,项目名称:satisfy,代码行数:17,代码来源:WebserviceSteps.java

示例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);
    }
}
 
开发者ID:alfa-laboratory,项目名称:colibri-ui-template,代码行数:22,代码来源:PickerWheelSteps.java

示例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);
}
 
开发者ID:pau-minoves,项目名称:jseats,代码行数:18,代码来源:Steps.java

示例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);
    }
}
 
开发者ID:sporcina,项目名称:dynamodb-connector,代码行数:18,代码来源:DocumentSteps.java

示例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();
    }
}
 
开发者ID:vactowb,项目名称:jbehave-core,代码行数:17,代码来源:PerformanceSteps.java

示例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);
}
 
开发者ID:alfa-laboratory,项目名称:colibri-ui,代码行数:8,代码来源:TextFieldSteps.java

示例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("Не удалось ввести");
    }
}
 
开发者ID:alfa-laboratory,项目名称:colibri-ui,代码行数:10,代码来源:TextFieldSteps.java


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