本文整理汇总了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");
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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");
}
示例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);
}
示例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);
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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());
}
};
}
示例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() + ";");
}
};
}