mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
make yaml,yml extensions uniform in code
This commit is contained in:
parent
1fa700b976
commit
5164a4d3e1
@ -1,5 +1,6 @@
|
||||
package io.nosqlbench.activitytype.cql.statements.core;
|
||||
|
||||
import io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtsLoader;
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityInitializationError;
|
||||
import io.nosqlbench.nb.api.content.Content;
|
||||
import io.nosqlbench.nb.api.content.NBIO;
|
||||
@ -29,7 +30,7 @@ public class YamlCQLStatementLoader {
|
||||
|
||||
public AvailableCQLStatements load(String fromPath, String... searchPaths) {
|
||||
|
||||
Content<?> yamlContent = NBIO.all().prefix(searchPaths).name(fromPath).extension("yaml").one();
|
||||
Content<?> yamlContent = NBIO.all().prefix(searchPaths).name(fromPath).extension(RawStmtsLoader.YAML_EXTENSIONS).one();
|
||||
String data = yamlContent.asString();
|
||||
|
||||
for (Function<String, String> xform : transformers) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.nosqlbench.activitytype.cql.statements.core;
|
||||
|
||||
import io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtsLoader;
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityInitializationError;
|
||||
import io.nosqlbench.nb.api.content.Content;
|
||||
import io.nosqlbench.nb.api.content.NBIO;
|
||||
@ -29,7 +30,7 @@ public class YamlCQLStatementLoader {
|
||||
|
||||
public AvailableCQLStatements load(String fromPath, String... searchPaths) {
|
||||
|
||||
Content<?> yamlContent = NBIO.all().prefix(searchPaths).name(fromPath).extension("yaml").one();
|
||||
Content<?> yamlContent = NBIO.all().prefix(searchPaths).name(fromPath).extension(RawStmtsLoader.YAML_EXTENSIONS).one();
|
||||
String data = yamlContent.asString();
|
||||
|
||||
for (Function<String, String> xform : transformers) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.nosqlbench.engine.api.scenarios;
|
||||
|
||||
import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
|
||||
import io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtsLoader;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.Scenarios;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
|
||||
import io.nosqlbench.engine.api.templating.StrInterpolator;
|
||||
@ -37,7 +38,7 @@ public class NBCLIScenarioParser {
|
||||
.prefix("activities")
|
||||
.prefix(includes)
|
||||
.name(workload)
|
||||
.extension("yaml")
|
||||
.extension(RawStmtsLoader.YAML_EXTENSIONS)
|
||||
.first();
|
||||
return found.isPresent();
|
||||
}
|
||||
@ -51,7 +52,7 @@ public class NBCLIScenarioParser {
|
||||
.prefix("activities")
|
||||
.prefix(includes)
|
||||
.name(workloadName)
|
||||
.extension("yaml")
|
||||
.extension(RawStmtsLoader.YAML_EXTENSIONS)
|
||||
.first();
|
||||
//
|
||||
Content<?> workloadContent = found.orElseThrow();
|
||||
@ -96,7 +97,7 @@ public class NBCLIScenarioParser {
|
||||
.prefix(SEARCH_IN)
|
||||
.prefix(includes)
|
||||
.name(workloadName)
|
||||
.extension("yaml")
|
||||
.extension(RawStmtsLoader.YAML_EXTENSIONS)
|
||||
.one();
|
||||
|
||||
StmtsDocList stmts = StatementsLoader.loadContent(logger, yamlWithNamedScenarios, userParams);
|
||||
@ -278,17 +279,10 @@ public class NBCLIScenarioParser {
|
||||
referenced = relative.toString();
|
||||
}
|
||||
}
|
||||
// String alternate = referenced.startsWith("/") ? referenced.substring(1) : referenced;
|
||||
// Optional<Content<?>> checkLoad = NBIO.all().prefix(SEARCH_IN)
|
||||
// .name(alternate).extension("yaml")
|
||||
// .first();
|
||||
// if (checkLoad.isPresent()) {
|
||||
// referenced = alternate;
|
||||
// }
|
||||
}
|
||||
|
||||
Content<?> content = NBIO.all().prefix(SEARCH_IN)
|
||||
.name(referenced).extension("yaml")
|
||||
.name(referenced).extension(RawStmtsLoader.YAML_EXTENSIONS)
|
||||
.one();
|
||||
|
||||
StmtsDocList stmts = StatementsLoader.loadContent(logger, content);
|
||||
@ -349,7 +343,7 @@ public class NBCLIScenarioParser {
|
||||
|
||||
List<Content<?>> activities = searchin
|
||||
.prefix(includes)
|
||||
.extension("yaml")
|
||||
.extension(RawStmtsLoader.YAML_EXTENSIONS)
|
||||
.list();
|
||||
|
||||
return filterForScenarios(activities);
|
||||
|
@ -6,6 +6,7 @@ import io.nosqlbench.engine.api.activityapi.cyclelog.outputs.cyclelog.CycleLogDu
|
||||
import io.nosqlbench.engine.api.activityapi.cyclelog.outputs.cyclelog.CycleLogImporterUtility;
|
||||
import io.nosqlbench.engine.api.activityapi.input.InputType;
|
||||
import io.nosqlbench.engine.api.activityapi.output.OutputType;
|
||||
import io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtsLoader;
|
||||
import io.nosqlbench.engine.api.metrics.ActivityMetrics;
|
||||
import io.nosqlbench.engine.core.annotation.Annotators;
|
||||
import io.nosqlbench.engine.core.lifecycle.ScenarioErrorHandler;
|
||||
@ -225,7 +226,7 @@ public class NBCLI {
|
||||
Optional<Content<?>> tocopy = NBIO.classpath()
|
||||
.prefix("activities")
|
||||
.prefix(options.wantsIncludes())
|
||||
.name(resourceToCopy).extension("yaml").first();
|
||||
.name(resourceToCopy).extension(RawStmtsLoader.YAML_EXTENSIONS).first();
|
||||
|
||||
if (tocopy.isEmpty()) {
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.nosqlbench.engine.rest.services;
|
||||
|
||||
import io.nosqlbench.engine.api.activityconfig.rawyaml.RawStmtsLoader;
|
||||
import io.nosqlbench.engine.api.scenarios.NBCLIScenarioParser;
|
||||
import io.nosqlbench.engine.api.scenarios.WorkloadDesc;
|
||||
import io.nosqlbench.engine.rest.transfertypes.WorkspaceItemView;
|
||||
@ -44,7 +45,7 @@ public class WorkSpace {
|
||||
}
|
||||
|
||||
public List<WorkloadDesc> getWorkloadsWithScenarioScripts() {
|
||||
List<Content<?>> candidates = NBIO.fs().prefix(this.getWorkspacePath().toString()).extension("yaml").list();
|
||||
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) {
|
||||
@ -82,7 +83,7 @@ public class WorkSpace {
|
||||
assertLegalWorkspacePath(targetPath);
|
||||
|
||||
if (targetPath.isAbsolute()) {
|
||||
throw new RuntimeException("You may not use absolute paths in workspaces: '" + targetPath.toString() + "'");
|
||||
throw new RuntimeException("You may not use absolute paths in workspaces: '" + targetPath + "'");
|
||||
}
|
||||
targetPath = this.workspacePath.resolve(targetPath);
|
||||
|
||||
@ -136,7 +137,7 @@ public class WorkSpace {
|
||||
|
||||
private void assertLegalWorkspacePath(Path target) {
|
||||
if (target.toString().contains("..")) {
|
||||
throw new RuntimeException("Possible path injection:" + target.toString());
|
||||
throw new RuntimeException("Possible path injection:" + target);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ public class NBIO implements NBPathsAPI.Facets {
|
||||
}
|
||||
|
||||
if (list.size() > 1) {
|
||||
String found = list.stream().map(c -> c.getURI().toString()).collect(Collectors.joining(","));
|
||||
String found = list.stream().map(c -> c.getURI().toString()).collect(Collectors.joining("\n","\n","\n"));
|
||||
throw new BasicError(("Found too many sources for '" + this + "', ambiguous name. Pick from " + found));
|
||||
}
|
||||
return list.get(0);
|
||||
|
Loading…
Reference in New Issue
Block a user