mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
partial rework of the NBIO internals for multiple results
This commit is contained in:
@@ -3,8 +3,9 @@ package io.nosqlbench.engine.cli;
|
||||
import ch.qos.logback.classic.Level;
|
||||
import io.nosqlbench.engine.api.metrics.IndicatorMode;
|
||||
import io.nosqlbench.engine.api.scenarios.NBCLIScenarioParser;
|
||||
import io.nosqlbench.nb.api.pathutil.NBPaths;
|
||||
import io.nosqlbench.engine.api.util.Unit;
|
||||
import io.nosqlbench.nb.api.content.Content;
|
||||
import io.nosqlbench.nb.api.content.NBIO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -322,10 +323,14 @@ public class NBCLIOptions {
|
||||
wantsToCopyWorkload = readWordOrThrow(arglist, "workload to copy");
|
||||
break;
|
||||
default:
|
||||
Optional<InputStream> optionalScript =
|
||||
NBPaths.findOptionalStreamOrFile(word, "js", "scripts/auto");
|
||||
Optional<Content<?>> scriptfile = NBIO.local()
|
||||
.prefix("scripts/auto")
|
||||
.name(word)
|
||||
.extension("js")
|
||||
.first();
|
||||
|
||||
//Script
|
||||
if (optionalScript.isPresent()) {
|
||||
if (scriptfile.isPresent()) {
|
||||
arglist.removeFirst();
|
||||
arglist.addFirst("scripts/auto/" + word);
|
||||
arglist.addFirst("script");
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package io.nosqlbench.engine.cli;
|
||||
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.nb.api.pathutil.NBPaths;
|
||||
import io.nosqlbench.engine.api.util.StrInterpolator;
|
||||
import io.nosqlbench.nb.api.content.Content;
|
||||
import io.nosqlbench.nb.api.content.NBIO;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -81,13 +82,9 @@ public class NBCLIScriptAssembly {
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
|
||||
InputStream resourceAsStream = NBPaths.findRequiredStreamOrFile(cmd.getCmdSpec(), "js", "scripts");
|
||||
Content<?> one = NBIO.all().prefix("scripts").name(cmd.getCmdSpec()).extension("js").one();
|
||||
scriptData = one.asString();
|
||||
|
||||
try (BufferedReader buffer = new BufferedReader(new InputStreamReader(resourceAsStream))) {
|
||||
scriptData = buffer.lines().collect(Collectors.joining("\n"));
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException("Unable to buffer " + cmd.getCmdSpec() + ": " + t);
|
||||
}
|
||||
StrInterpolator interpolator = new StrInterpolator(cmd.getCmdArgs());
|
||||
scriptData = interpolator.apply(scriptData);
|
||||
return new ScriptData(scriptData,cmd.getCmdArgs());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.nosqlbench.engine.cli;
|
||||
|
||||
import io.nosqlbench.docsys.core.PathWalker;
|
||||
import io.nosqlbench.nb.api.pathutil.NBPaths;
|
||||
import io.nosqlbench.nb.api.content.NBIO;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.net.URL;
|
||||
@@ -205,7 +205,7 @@ public class TestNBCLIOptions {
|
||||
String dir= "./";
|
||||
URL resource = getClass().getClassLoader().getResource(dir);
|
||||
assertThat(resource);
|
||||
Path basePath = NBPaths.findPathIn(dir);
|
||||
Path basePath = NBIO.getFirstLocalPath(dir);
|
||||
List<Path> yamlPathList = PathWalker.findAll(basePath).stream().filter(f -> f.toString().endsWith(".yaml")).collect(Collectors.toList());
|
||||
assertThat(yamlPathList);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user