當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。