Search in sources :

Example 11 with When

use of org.jbehave.core.annotations.When in project jbehave-core by jbehave.

the class OrganizationSteps method setCurrentOrganization.

@When("current organization is $orgName")
public void setCurrentOrganization(String orgName) {
    Organization org = organizationDao.findByName(orgName);
    organizationManager.setOrganization(org);
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) When(org.jbehave.core.annotations.When)

Example 12 with When

use of org.jbehave.core.annotations.When in project jbehave-core by jbehave.

the class RESTSteps method storyIsUploaded.

@When("story $name is uploaded appending '$text'")
public void storyIsUploaded(String name, String text) {
    ResourceUploader uploader = resourceupLoader();
    Resource resource = index.get(name);
    resource.setContent(resource.getContent() + " " + text);
    uploader.uploadResource(resource);
}
Also used : ResourceUploader(org.jbehave.core.io.rest.ResourceUploader) Resource(org.jbehave.core.io.rest.Resource) When(org.jbehave.core.annotations.When)

Example 13 with When

use of org.jbehave.core.annotations.When in project jbehave-core by jbehave.

the class RESTSteps method whenStoriesAreExported.

@When("stories in $sourcePath are exported to $rootURI")
public void whenStoriesAreExported(String sourcePath, String rootURI) {
    ResourceExporter exporter = new ExportFromFilesystem(resourceIndexer(), resourceupLoader(), sourcePath, ".story", "", "**/*.story");
    exporter.exportResources(rootURI);
}
Also used : ResourceExporter(org.jbehave.core.io.rest.ResourceExporter) ExportFromFilesystem(org.jbehave.core.io.rest.filesystem.ExportFromFilesystem) When(org.jbehave.core.annotations.When)

Example 14 with When

use of org.jbehave.core.annotations.When in project jbehave-core by jbehave.

the class RESTSteps method indexIsRetrieved.

@When("index is retrieved from $uri")
public void indexIsRetrieved(String uri) {
    ResourceIndexer indexer = resourceIndexer();
    index = indexer.indexResources(uri);
}
Also used : ResourceIndexer(org.jbehave.core.io.rest.ResourceIndexer) When(org.jbehave.core.annotations.When)

Example 15 with When

use of org.jbehave.core.annotations.When in project jbehave-core by jbehave.

the class PerformanceSteps method aScenarioWithVeryLongTables.

@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();
    }
}
Also used : FileWriter(java.io.FileWriter) IOException(java.io.IOException) File(java.io.File) When(org.jbehave.core.annotations.When)

Aggregations

When (org.jbehave.core.annotations.When)30 CompilationUnit (com.github.javaparser.ast.CompilationUnit)21 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)5 JavaParser (com.github.javaparser.JavaParser)3 ParserConfiguration (com.github.javaparser.ParserConfiguration)2 File (java.io.File)2 Resource (org.jbehave.core.io.rest.Resource)2 Modifier (com.github.javaparser.ast.Modifier)1 PackageDeclaration (com.github.javaparser.ast.PackageDeclaration)1 ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)1 BlockStmt (com.github.javaparser.ast.stmt.BlockStmt)1 VoidType (com.github.javaparser.ast.type.VoidType)1 CloneVisitor (com.github.javaparser.ast.visitor.CloneVisitor)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 HttpResponse (org.apache.http.HttpResponse)1