mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
partial work for search within
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -46,4 +46,4 @@ public class NosqlBenchFilesTest {
|
||||
// Optional<InputStream> inputStream = NosqlBenchFiles.getInputStream(url);
|
||||
// assertThat(inputStream).isPresent();
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user