當前位置: 首頁>>代碼示例>>Java>>正文


Java Given類代碼示例

本文整理匯總了Java中org.jbehave.core.annotations.Given的典型用法代碼示例。如果您正苦於以下問題:Java Given類的具體用法?Java Given怎麽用?Java Given使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Given類屬於org.jbehave.core.annotations包,在下文中一共展示了Given類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: whenIStartKafkaMonitoring

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("I start Kafka monitoring")
public void whenIStartKafkaMonitoring() throws InterruptedException {
    try (KafkaMonitor kafkaMonitor = new KafkaMonitorBuilder(kfEndpoints, zkEndpoints)
            .withZookeeperSessionTimeout(1000)
            .withKafkaPollingInitialDelayTime(0)
            .withKafkaPollingDelayTime(1000)
            .build()) {
        kafkaMonitor.start();
        while (kafkaMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.OK) {
            Thread.sleep(500);
            System.out.println("Waiting for kafka to be up and running ... ");
        }
    } catch (Exception e) {
        fail("Error creating a kafka monitor. Error: " + e.getMessage());
        e.printStackTrace();
    }
    System.out.println("Kafka is up and running");
}
 
開發者ID:mcafee,項目名稱:management-sdk-for-kafka,代碼行數:19,代碼來源:TopicServiceSteps.java

示例2: userIsLoggedIn

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("the user \"$username\" with the password of \"$password\" is logged into the system expecting \"$datatype\"")
public void userIsLoggedIn(String username, String password, String datatype) {
    WebClient client;

    if (datatype.equals("JSON")) {
        JacksonJsonProvider json = new JacksonJsonProvider();

        client = WebClient.create(baseURL, Collections.singletonList(json), true);
        client.type(MediaType.APPLICATION_JSON_TYPE).accept(MediaType.APPLICATION_JSON_TYPE);
    } else {
        client = WebClient.create(baseURL, true);
        client.type(MediaType.APPLICATION_XML_TYPE).accept(MediaType.APPLICATION_XML_TYPE);
    }
    String authorizationHeader = "Basic " +
            org.apache.cxf.common.util.Base64Utility.encode((username + ":" + password).getBytes());
    client.header("Authorization", authorizationHeader);

    getState().put(KEY_WEB_CLIENT, client);
}
 
開發者ID:apache,項目名稱:rave,代碼行數:20,代碼來源:CommonSteps.java

示例3: addResultDecorator

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given(value = "result has decorator $decorator $param", priority = 1)
public void addResultDecorator(String decorator, String param) {
	switch (decorator) {
	case "Null":
		processor.addResultDecorator(new NullResultDecorator());
		break;
	case "AppendTextToCandidateNameDecorator":
		processor
				.addResultDecorator(new AppendTextToCandidateNameDecorator(
						param));
		break;
	case "SuffixTextToCandidateNameDecorator":
		processor
				.addResultDecorator(new SuffixTextToCandidateNameDecorator(
						param));
		break;
	}
}
 
開發者ID:pau-minoves,項目名稱:jseats,代碼行數:19,代碼來源:Steps.java

示例4: whenIStartKafkaMonitoring

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("I start Kafka monitoring")
public void whenIStartKafkaMonitoring() throws InterruptedException {
    KafkaMonitor kafkaMonitor = new KafkaMonitorBuilder(kfEndpoints, zkEndpoints)
            .withZookeeperSessionTimeout(1000)
            .withKafkaPollingInitialDelayTime(0)
            .withKafkaPollingDelayTime(1000)
            .build();
    kafkaMonitor.start();
    while (kafkaMonitor.getCluster().getKfClusterStatus() != KFClusterStatusName.OK) {
        Thread.sleep(500);
    }
}
 
開發者ID:mcafee,項目名稱:management-sdk-for-kafka,代碼行數:13,代碼來源:CreateTopicSteps.java

示例5: createStack

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("a stack with elements")
public void createStack() {
    stack.clear();
    stack.push("a");
    stack.push("b");
    stack.push("c");
}
 
開發者ID:allure-framework,項目名稱:allure-java,代碼行數:8,代碼來源:StackSteps.java

示例6: givenUniqueStringWithPrefixAndLengthSavedToVariable

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("unique string with prefix '$prefix' and '$length' length saved to '$name' variable")
public void givenUniqueStringWithPrefixAndLengthSavedToVariable(String prefix, int length, String name) {
    String uniqueString = String.valueOf(UUID.randomUUID()).replace("-",
            "");
    String textElement = StringUtils.rightPad(prefix, length, uniqueString);
    SessionVariablesUtils.save(name, textElement);
}
 
開發者ID:tapack,項目名稱:satisfy,代碼行數:8,代碼來源:DataGenerationSteps.java

示例7: webServiceEndpointAndWebServiceSoapAction

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("web service endpoint '$webServiceEndpointUrl' and web service soap action '$webServiceSoapAction'")
public void webServiceEndpointAndWebServiceSoapAction(String webServiceEndpointUrl, String webServiceSoapAction) {
    Thucydides.getCurrentSession().put(WEB_SERVICE_ENDPOINT_URL_KEY, webServiceEndpointUrl);
    LOGGER.info("Saved web service endpoint is: " + webServiceEndpointUrl);
    Thucydides.getCurrentSession().put(WEB_SERVICE_SOAP_ACTION_KEY, webServiceSoapAction);
    LOGGER.info("Saved web service soap action is: " + webServiceSoapAction);
}
 
開發者ID:tapack,項目名稱:satisfy,代碼行數:8,代碼來源:WebserviceSteps.java

示例8: givenFakeSOAPWebservice

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("start SOAP webservice port '$port'")
public void givenFakeSOAPWebservice(String port) {
    String serviceUrl = "http://localhost:" + port + "/WheatherServicePort";
    Endpoint endpoint = Endpoint.publish(serviceUrl, new WheatherServiceImpl());
    assertTrue(endpoint.isPublished());
    Assert.assertEquals("http://schemas.xmlsoap.org/wsdl/soap/http", endpoint.getBinding().getBindingID());
}
 
開發者ID:tapack,項目名稱:satisfy,代碼行數:8,代碼來源:FakeSoapServiceSteps.java

示例9: givenFakeSOAPWebserviceThroughHttps

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("send SOAP web service through https")
public void givenFakeSOAPWebserviceThroughHttps() {
    SpringBusFactory factory = new SpringBusFactory();
    Bus bus = factory.createBus("src/test/resources/META-INF/spring/jaxws-server-with-ssl.xml");
    BusFactory.setDefaultBus(bus);
    Endpoint endpoint = Endpoint.publish("https://localhost:9091/WheatherServicePort", new WheatherServiceImpl());
    assertTrue(endpoint.isPublished());
    Assert.assertEquals("http://schemas.xmlsoap.org/wsdl/soap/http", endpoint.getBinding().getBindingID());
}
 
開發者ID:tapack,項目名稱:satisfy,代碼行數:10,代碼來源:FakeSoapServiceSteps.java

示例10: negative

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("a negative scenario")
@When("a negative scenario")
@Then("a negative scenario")
default boolean negative(){

    return true;
}
 
開發者ID:kishor32,項目名稱:kabo,代碼行數:8,代碼來源:StepDefinition.java

示例11: positive

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("a positive scenario")
@When("a positive scenario")
@Then("a positive scenario")
default boolean positive(){

    return true;
}
 
開發者ID:kishor32,項目名稱:kabo,代碼行數:8,代碼來源:StepDefinition.java

示例12: configurePgpPlugin

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("the user configure pgp plugin")
public void configurePgpPlugin() throws InterruptedException {
    subutaiSteps.clickOnIconPgp();
    subutaiSteps.clickOnButtonOptions();
    subutaiSteps.typeInFieldsPgp();
    subutaiSteps.clickOnButtonSubmit();
    subutaiSteps.waitGeneratedE2EKey();
    subutaiSteps.clickOnSubutaiSocialTab();
}
 
開發者ID:subutai-io,項目名稱:playbooks,代碼行數:10,代碼來源:DefSubutaiStepsGiven.java

示例13: checkDataLunOnEvidenceStore

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("a readable evidence storagebitmap of disk $lun of $name")
public void checkDataLunOnEvidenceStore(final int lun, final String name) throws IOException {
    final File file = getBitmapFileForClient(lun, name);
    final RandomAccessFile bitmapFile = new RandomAccessFile(file, "r");
    assertTrue("Unable to open bitmapfile", bitmapFile != null);
    final byte[] bitmapBuffer = new byte[(int) bitmapFile.length()];
    bitmapFile.readFully(bitmapBuffer);
    _bitmap = BitSet.valueOf(bitmapBuffer);
}
 
開發者ID:raqet,項目名稱:acquisition-server,代碼行數:10,代碼來源:RaqetSteps.java

示例14: givenAVoidVisitorAdapterWithAVisitMethodThatChangesVariableNamesToUppercase

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("a VoidVisitorAdapter with a visit method that changes variable names to uppercase")
public void givenAVoidVisitorAdapterWithAVisitMethodThatChangesVariableNamesToUppercase() {
    toUpperCaseVariableNameVisitor = new VoidVisitorAdapter<AtomicReference<String>>() {
        @Override
        public void visit(VariableDeclaratorId n, AtomicReference<String> arg) {
            n.setName(n.getName().toUpperCase());
        }
    };
}
 
開發者ID:plum-umd,項目名稱:java-sketch,代碼行數:10,代碼來源:VisitorSteps.java

示例15: givenAVoidVisitorAdapterWithAVisitMethodThatCollectsTheVariableName

import org.jbehave.core.annotations.Given; //導入依賴的package包/類
@Given("a VoidVisitorAdapter with a visit method and collects the variable names")
public void givenAVoidVisitorAdapterWithAVisitMethodThatCollectsTheVariableName() {
    collectVariableNameVisitor = new VoidVisitorAdapter<AtomicReference<String>>() {
        @Override
        public void visit(VariableDeclaratorId n, AtomicReference<String> arg) {
            arg.set(arg.get() + n.getName() + ";");
        }
    };
}
 
開發者ID:plum-umd,項目名稱:java-sketch,代碼行數:10,代碼來源:VisitorSteps.java


注:本文中的org.jbehave.core.annotations.Given類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。