use of org.jbehave.core.io.rest.ResourceUploader 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);
}
use of org.jbehave.core.io.rest.ResourceUploader in project jbehave-core by jbehave.
the class ExportFromFilesystemBehaviour method canExportFromFilesystem.
@Test
public void canExportFromFilesystem() throws IOException {
// Given
ResourceIndexer indexer = mock(ResourceIndexer.class);
ResourceUploader uploader = mock(ResourceUploader.class);
String rootURI = "http://wiki";
String text1 = "story1";
String text2 = "story2";
String sourcePath = "target/stories";
String sourceExt = ".story";
String sourceSyntax = "jbehave/3.0";
File file1 = new File(sourcePath + "/A_story" + sourceExt);
write(text1, file1);
File file2 = new File(sourcePath + "/Another_story" + sourceExt);
write(text2, file2);
Map<String, Resource> index = new HashMap<>();
Resource aResource = new Resource(rootURI + "/A_story");
index.put("A_story", aResource);
Resource anotherResource = new Resource(rootURI + "/Another_story");
index.put("Another_story", anotherResource);
String includes = "**";
when(indexer.indexResources(rootURI, sourcePath, sourceSyntax, includes)).thenReturn(index);
// When
ResourceExporter exporter = new ExportFromFilesystem(indexer, uploader, sourcePath, sourceExt, sourceSyntax, includes);
exporter.exportResources(rootURI);
// Then
verify(uploader).uploadResource(aResource);
verify(uploader).uploadResource(anotherResource);
}
use of org.jbehave.core.io.rest.ResourceUploader in project jbehave-core by jbehave.
the class ExportFromFilesystemMojo method createExporter.
private ResourceExporter createExporter() {
ResourceIndexer indexer = newResourceIndexer();
ResourceUploader uploader = newResourceUploader();
getLog().info("Creating exporter from filesystem using REST provider " + restProvider + " with resourcesPath " + resourcesPath + ", resourcesExt " + resourcesExt + ", resourcesSyntax " + resourcesSyntax + " and resourcesIncludes " + resourcesIncludes);
return new ExportFromFilesystem(indexer, uploader, resourcesPath, resourcesExt, resourcesSyntax, resourcesIncludes);
}
Aggregations