use of io.nosqlbench.nb.api.content.Content in project nosqlbench by nosqlbench.
the class ResolverForURLTest method testCPResource.
@Test
public void testCPResource() {
String cprootForTestContext = "target/test-classes/";
String resourcePathWithinClasspathRoots = "nesteddir1/nesteddir2/testcsv12.csv";
ResolverForClasspath r = new ResolverForClasspath();
List<Content<?>> c = r.resolve(resourcePathWithinClasspathRoots);
assertThat(c).isNotNull();
Object location = c.get(0).getLocation();
assertThat(location.toString()).isEqualTo(cprootForTestContext + resourcePathWithinClasspathRoots);
String q = "src/test/resources/nesteddir1/nesteddir2/testcsv12.csv";
List<Content<?>> notfound = r.resolve(q);
assertThat(notfound).isEmpty();
}
use of io.nosqlbench.nb.api.content.Content in project nosqlbench by nosqlbench.
the class ResolverForURLTest method testFileResource.
@Test
public void testFileResource() {
String p = "src/test/resources/nesteddir1/nesteddir2/testcsv12.csv";
ResolverForFilesystem r = new ResolverForFilesystem();
List<Content<?>> c = r.resolve(p);
assertThat(c).isNotNull();
Object location = c.get(0).getLocation();
assertThat(location).isInstanceOf(Path.class);
assertThat(location.toString()).isEqualTo(p);
String q = "nesteddir1/nesteddir2/testcsv12.csv";
List<Content<?>> notfound = r.resolve(q);
assertThat(notfound).isEmpty();
}
use of io.nosqlbench.nb.api.content.Content in project nosqlbench by nosqlbench.
the class ResolverForURLTest method testUrlResource.
@Test
public void testUrlResource() {
ResolverForURL r = new ResolverForURL();
List<Content<?>> c = r.resolve("http://google.com");
assertThat(c).isNotNull();
Object location = c.get(0).getLocation();
assertThat(location).isInstanceOf(URL.class);
assertThat(location.toString()).isEqualTo("http://google.com");
}
use of io.nosqlbench.nb.api.content.Content in project nosqlbench by nosqlbench.
the class DocsRootDirectory method getMarkdownInfo.
@Override
public List<Content<?>> getMarkdownInfo() {
List<Content<?>> list = NBIO.local().name(getRootPathName()).list();
NBIOWalker.CollectVisitor capture = new NBIOWalker.CollectVisitor(true, false);
NBIOWalker.RegexFilter filter = new NBIOWalker.RegexFilter("\\.md", true);
for (Content<?> content : list) {
Path path = content.asPath();
NBIOWalker.walkFullPath(path, capture, filter);
}
List<Content<?>> content = new ArrayList<>();
for (Path path : capture.get()) {
content.add(new PathContent(path));
}
return content;
}
use of io.nosqlbench.nb.api.content.Content in project nosqlbench by nosqlbench.
the class WorkSpace method getWorkloadsWithScenarioScripts.
public List<WorkloadDesc> getWorkloadsWithScenarioScripts() {
List<Content<?>> candidates = NBIO.fs().prefix(this.getWorkspacePath().toString()).extension(RawStmtsLoader.YAML_EXTENSIONS).list();
List<WorkloadDesc> workloads = NBCLIScenarioParser.filterForScenarios(candidates);
List<WorkloadDesc> relativized = new ArrayList<>();
for (WorkloadDesc workload : workloads) {
WorkloadDesc relative = workload.relativize(getWorkspacePath());
relativized.add(relative);
}
return relativized;
}
Aggregations