mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-25 08:11:06 -06:00
partial work for search within
This commit is contained in:
parent
62f1e3ef7e
commit
9642a2b545
@ -1,7 +1,7 @@
|
||||
package io.nosqlbench.activitytype.cql.statements.core;
|
||||
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityInitializationError;
|
||||
import io.nosqlbench.engine.api.util.NosqlBenchFiles;
|
||||
import io.nosqlbench.engine.api.util.NBFiles;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.yaml.snakeyaml.TypeDescription;
|
||||
@ -32,7 +32,7 @@ public class YamlCQLStatementLoader {
|
||||
|
||||
public AvailableCQLStatements load(String fromPath, String... searchPaths) {
|
||||
|
||||
InputStream stream = NosqlBenchFiles.findRequiredStreamOrFile(fromPath,
|
||||
InputStream stream = NBFiles.findRequiredStreamOrFile(fromPath,
|
||||
"yaml", searchPaths);
|
||||
String data = "";
|
||||
try (BufferedReader buffer = new BufferedReader(new InputStreamReader(stream))) {
|
||||
|
@ -19,7 +19,7 @@ package io.nosqlbench.engine.api.activityconfig.rawyaml;
|
||||
|
||||
import io.nosqlbench.engine.api.activityconfig.snakecharmer.SnakeYamlCharmer;
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityInitializationError;
|
||||
import io.nosqlbench.engine.api.util.NosqlBenchFiles;
|
||||
import io.nosqlbench.engine.api.util.NBFiles;
|
||||
import org.slf4j.Logger;
|
||||
import org.yaml.snakeyaml.TypeDescription;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
@ -27,7 +27,6 @@ import org.yaml.snakeyaml.Yaml;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -56,7 +55,7 @@ public class RawYamlStatementLoader {
|
||||
}
|
||||
|
||||
protected String loadRawFile(Logger logger, String fromPath, String... searchPaths) {
|
||||
InputStream stream = NosqlBenchFiles.findRequiredStreamOrFile(fromPath, "yaml", searchPaths);
|
||||
InputStream stream = NBFiles.findRequiredStreamOrFile(fromPath, "yaml", searchPaths);
|
||||
try (BufferedReader buffer = new BufferedReader(new InputStreamReader(stream))) {
|
||||
return buffer.lines().collect(Collectors.joining("\n"));
|
||||
} catch (Exception e) {
|
||||
|
@ -34,9 +34,9 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class NosqlBenchFiles {
|
||||
public class NBFiles {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(NosqlBenchFiles.class);
|
||||
private final static Logger logger = LoggerFactory.getLogger(NBFiles.class);
|
||||
private static Pattern templatePattern = Pattern.compile("TEMPLATE\\((.+?)\\)");
|
||||
private static Pattern templatePattern2 = Pattern.compile("<<(.+?)>>");
|
||||
|
||||
@ -127,7 +127,7 @@ public class NosqlBenchFiles {
|
||||
}
|
||||
|
||||
// Classpath
|
||||
ClassLoader classLoader = NosqlBenchFiles.class.getClassLoader();
|
||||
ClassLoader classLoader = NBFiles.class.getClassLoader();
|
||||
InputStream stream = classLoader.getResourceAsStream(path);
|
||||
if (stream != null) {
|
||||
return Optional.of(stream);
|
@ -25,11 +25,11 @@ import java.util.Optional;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@Test
|
||||
public class NosqlBenchFilesTest {
|
||||
public class NBFilesTest {
|
||||
|
||||
@Test
|
||||
public void testNestedClasspathLoading() {
|
||||
Optional<InputStream> optionalStreamOrFile = NosqlBenchFiles.findOptionalStreamOrFile("nested/testfile", "txt", "activities");
|
||||
Optional<InputStream> optionalStreamOrFile = NBFiles.findOptionalStreamOrFile("nested/testfile", "txt", "activities");
|
||||
assertThat(optionalStreamOrFile).isPresent();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import io.nosqlbench.engine.api.activityapi.cyclelog.outputs.cyclelog.CycleLogIm
|
||||
import io.nosqlbench.engine.api.activityapi.input.InputType;
|
||||
import io.nosqlbench.engine.api.activityapi.output.OutputType;
|
||||
import io.nosqlbench.engine.api.exceptions.BasicError;
|
||||
import io.nosqlbench.engine.api.util.NosqlBenchFiles;
|
||||
import io.nosqlbench.engine.api.util.NBFiles;
|
||||
import io.nosqlbench.engine.core.MarkdownDocInfo;
|
||||
import io.nosqlbench.engine.core.ScenarioLogger;
|
||||
import io.nosqlbench.engine.core.ScenariosResults;
|
||||
@ -233,8 +233,8 @@ public class NBCLI {
|
||||
}
|
||||
|
||||
public void printWorkloads() {
|
||||
List<NosqlBenchFiles.WorkloadDesc> workloads = NosqlBenchFiles.getWorkloadsWithScenarioScripts();
|
||||
for (NosqlBenchFiles.WorkloadDesc workload : workloads) {
|
||||
List<NBFiles.WorkloadDesc> workloads = NBFiles.getWorkloadsWithScenarioScripts();
|
||||
for (NBFiles.WorkloadDesc workload : workloads) {
|
||||
System.out.println("\n# from: "+ workload.getYamlPath());
|
||||
List<String> scenarioList = workload.getScenarioNames();
|
||||
String workloadName = workload.getYamlPath().replaceAll("\\.yaml", "") ;
|
||||
|
@ -2,7 +2,7 @@ package io.nosqlbench.engine.cli;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import io.nosqlbench.engine.api.metrics.IndicatorMode;
|
||||
import io.nosqlbench.engine.api.util.NosqlBenchFiles;
|
||||
import io.nosqlbench.engine.api.util.NBFiles;
|
||||
import io.nosqlbench.engine.api.util.Unit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -303,7 +303,7 @@ public class NBCLIOptions {
|
||||
break;
|
||||
default:
|
||||
Optional<InputStream> optionalScript =
|
||||
NosqlBenchFiles.findOptionalStreamOrFile(word, "js", "scripts/auto");
|
||||
NBFiles.findOptionalStreamOrFile(word, "js", "scripts/auto");
|
||||
//Script
|
||||
if (optionalScript.isPresent()) {
|
||||
arglist.removeFirst();
|
||||
|
@ -4,7 +4,7 @@ import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.Scenarios;
|
||||
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
|
||||
import io.nosqlbench.engine.api.exceptions.BasicError;
|
||||
import io.nosqlbench.engine.api.util.NosqlBenchFiles;
|
||||
import io.nosqlbench.engine.api.util.NBFiles;
|
||||
import io.nosqlbench.engine.api.util.StrInterpolator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -23,14 +23,14 @@ public class NBCLIScenarioParser {
|
||||
private final static Logger logger = LoggerFactory.getLogger(NBCLIScenarioParser.class);
|
||||
|
||||
public static boolean isFoundWorkload(String word) {
|
||||
Optional<Path> workloadPath = NosqlBenchFiles.findOptionalPath(word, "yaml", "activities");
|
||||
Optional<Path> workloadPath = NBFiles.findOptionalPath(word, "yaml", false, "activities");
|
||||
return workloadPath.isPresent();
|
||||
}
|
||||
|
||||
public static void parseScenarioCommand(LinkedList<String> arglist) {
|
||||
|
||||
String workloadName = arglist.removeFirst();
|
||||
Optional<Path> workloadPathSearch = NosqlBenchFiles.findOptionalPath(workloadName, "yaml", "activities");
|
||||
Optional<Path> workloadPathSearch = NBFiles.findOptionalPath(workloadName, "yaml", false, "activities");
|
||||
Path workloadPath = workloadPathSearch.orElseThrow();
|
||||
|
||||
List<String> scenarioNames = new ArrayList<>();
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.nosqlbench.engine.cli;
|
||||
|
||||
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
|
||||
import io.nosqlbench.engine.api.util.NosqlBenchFiles;
|
||||
import io.nosqlbench.engine.api.util.NBFiles;
|
||||
import io.nosqlbench.engine.api.util.StrInterpolator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -81,7 +81,7 @@ public class NBCLIScriptAssembly {
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
|
||||
InputStream resourceAsStream = NosqlBenchFiles.findRequiredStreamOrFile(cmd.getCmdSpec(), "js", "scripts");
|
||||
InputStream resourceAsStream = NBFiles.findRequiredStreamOrFile(cmd.getCmdSpec(), "js", "scripts");
|
||||
|
||||
try (BufferedReader buffer = new BufferedReader(new InputStreamReader(resourceAsStream))) {
|
||||
scriptData = buffer.lines().collect(Collectors.joining("\n"));
|
||||
|
@ -12,7 +12,7 @@ import com.github.dockerjava.api.model.ContainerNetworkSettings;
|
||||
import com.github.dockerjava.api.model.Frame;
|
||||
import com.github.dockerjava.core.async.ResultCallbackTemplate;
|
||||
import com.github.dockerjava.core.command.LogContainerResultCallback;
|
||||
import io.nosqlbench.engine.api.util.NosqlBenchFiles;
|
||||
import io.nosqlbench.engine.api.util.NBFiles;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -147,7 +147,7 @@ public class DockerMetricsManager {
|
||||
}
|
||||
|
||||
private void setupPromFiles(String ip) {
|
||||
String datasource = NosqlBenchFiles.readFile("docker/prometheus/prometheus.yml");
|
||||
String datasource = NBFiles.readFile("docker/prometheus/prometheus.yml");
|
||||
|
||||
if (ip == null) {
|
||||
logger.error("IP for graphite container not found");
|
||||
|
@ -1,7 +1,7 @@
|
||||
package io.nosqlbench.engine.docker;
|
||||
|
||||
import io.nosqlbench.engine.api.exceptions.BasicError;
|
||||
import io.nosqlbench.engine.api.util.NosqlBenchFiles;
|
||||
import io.nosqlbench.engine.api.util.NBFiles;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -36,7 +36,7 @@ public class RestHelper {
|
||||
|
||||
if (path !=null) {
|
||||
logger.debug("POSTing " + path + " to " + url);
|
||||
String dashboard = NosqlBenchFiles.readFile(path);
|
||||
String dashboard = NBFiles.readFile(path);
|
||||
logger.debug("length of content for " + path + " is " + dashboard.length());
|
||||
builder = builder.POST(HttpRequest.BodyPublishers.ofString(dashboard));
|
||||
builder.setHeader("Content-Type", "application/json");
|
||||
|
@ -17,12 +17,12 @@
|
||||
|
||||
package io.nosqlbench.engine.extensions.files;
|
||||
|
||||
import io.nosqlbench.engine.api.util.NosqlBenchFiles;
|
||||
import io.nosqlbench.engine.api.util.NBFiles;
|
||||
|
||||
public class FileAccess extends FileAccessPluginData {
|
||||
|
||||
public String read(String filepath) {
|
||||
String filedata = NosqlBenchFiles.readFile(filepath);
|
||||
String filedata = NBFiles.readFile(filepath);
|
||||
return filedata;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user