post-merge fix-ups

This commit is contained in:
Jonathan Shook
2021-06-22 11:10:42 -05:00
339 changed files with 1331 additions and 1251 deletions

View File

@@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>4.15.48-SNAPSHOT</version>
<version>4.15.51-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@@ -23,13 +23,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-core</artifactId>
<version>4.15.48-SNAPSHOT</version>
<version>4.15.51-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-docker</artifactId>
<version>4.15.48-SNAPSHOT</version>
<version>4.15.51-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -30,7 +30,6 @@ import io.nosqlbench.nb.api.errors.BasicError;
import io.nosqlbench.nb.api.logging.NBLogLevel;
import io.nosqlbench.nb.api.markdown.exporter.MarkdownExporter;
import io.nosqlbench.virtdata.userlibs.apps.VirtDataMainApp;
import joptsimple.internal.Strings;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
@@ -299,7 +298,7 @@ public class NBCLI {
.session(sessionName)
.now()
.layer(Layer.CLI)
.detail("cli", Strings.join(args, "\n"))
.detail("cli", String.join("\n", args))
.build()
);

View File

@@ -2,7 +2,6 @@ package io.nosqlbench.engine.cli;
import io.nosqlbench.nb.api.NBEnvironment;
import io.nosqlbench.nb.api.errors.BasicError;
import joptsimple.internal.Strings;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
@@ -338,7 +337,7 @@ public class NBCLIArgsFile {
}
}
if (splitword.length() > 0) {
throw new RuntimeException("unqualified line continuation for '" + splitword.toString() + "'");
throw new RuntimeException("unqualified line continuation for '" + splitword + "'");
}
return loaded;
@@ -426,13 +425,13 @@ public class NBCLIArgsFile {
String word = iter.next();
if (word.startsWith("-")) {
if (element.size() > 0) {
lines.add(Strings.join(element, " "));
lines.add(String.join(" ", element));
element.clear();
}
}
element.add(word);
}
lines.add(Strings.join(element, " "));
lines.add(String.join(" ", element));
return lines;
}

View File

@@ -1,10 +1,11 @@
package io.nosqlbench.engine.cli;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class BasicScriptBufferTest {
@@ -62,14 +63,9 @@ public class BasicScriptBufferTest {
assertThat(script).matches("(?s).*a single line.*");
}
@Test(expected = NumberFormatException.class)
@Test
public void shouldThrowErrorForInvalidWaitMillisOperand() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "waitmillis", "noway" });
BasicScriptBuffer b = new BasicScriptBuffer();
b.add(opts.getCommands().toArray(new Cmd[0]));
String s = b.getParsedScript();
assertThatExceptionOfType(NumberFormatException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "waitmillis", "noway" }));
}
}

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.engine.cli;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.LinkedList;
import java.util.List;

View File

@@ -1,6 +1,6 @@
package io.nosqlbench.engine.cli;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.nio.file.Files;
@@ -10,6 +10,7 @@ import java.util.LinkedList;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class NBCLIArgsFileTest {
@@ -30,11 +31,11 @@ public class NBCLIArgsFileTest {
System.out.println(result);
}
@Test(expected = RuntimeException.class)
@Test
public void testLoadingMissingRequiredFails() {
LinkedList<String> result;
NBCLIArgsFile argsFile = new NBCLIArgsFile();
result = argsFile.process("--argsfile-required", "src/test/resources/argsfiles/nonextant.cli");
assertThatExceptionOfType(RuntimeException.class)
.isThrownBy(() -> argsFile.process("--argsfile-required", "src/test/resources/argsfiles/nonextant.cli"));
}
@Test

View File

@@ -2,11 +2,12 @@ package io.nosqlbench.engine.cli;
import io.nosqlbench.engine.api.scenarios.NBCLIScenarioParser;
import io.nosqlbench.nb.api.errors.BasicError;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class NBCLIScenarioParserTest {
@@ -49,15 +50,16 @@ public class NBCLIScenarioParserTest {
assertThat(cmds.get(0).getArg("driver")).isEqualTo("stdout");
}
@Test(expected = BasicError.class)
@Test
public void testThatVerboseFinalParameterThrowsError() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "scenario-test", "yaml=canttouchthis"});
List<Cmd> cmds = opts.getCommands();
assertThatExceptionOfType(BasicError.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "scenario-test", "yaml=canttouchthis"}));
}
@Test(expected = BasicError.class)
@Test
public void testThatMissingScenarioNameThrowsError() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "scenario-test", "missing-scenario"});
assertThatExceptionOfType(BasicError.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "scenario-test", "missing-scenario"}));
}
@Test

View File

@@ -17,7 +17,7 @@
package io.nosqlbench.engine.cli;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

View File

@@ -2,7 +2,7 @@ package io.nosqlbench.engine.cli;
import io.nosqlbench.docsys.core.PathWalker;
import io.nosqlbench.nb.api.content.NBIO;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.net.URL;
import java.nio.file.Path;
@@ -11,6 +11,7 @@ import java.util.List;
import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
public class TestNBCLIOptions {
@@ -87,9 +88,10 @@ public class TestNBCLIOptions {
assertThat(opts.wantsTopicalHelp()).isFalse();
}
@Test(expected = IllegalArgumentException.class)
@Test
public void shouldErrorSanelyWhenNoMatch() {
NBCLIOptions opts = new NBCLIOptions(new String[]{"unrecognizable command"});
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{"unrecognizable command"}));
}
@Test
@@ -102,14 +104,16 @@ public class TestNBCLIOptions {
assertThat(cmd.getParams().get("param1")).isEqualTo("value1");
}
@Test(expected = InvalidParameterException.class)
@Test
public void testShouldErrorSanelyWhenScriptNameSkipped() {
NBCLIOptions opts = new NBCLIOptions(new String[]{"script", "param1=value1"});
assertThatExceptionOfType(InvalidParameterException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{"script", "param1=value1"}));
}
@Test(expected = InvalidParameterException.class)
@Test
public void testShouldErrorForMissingScriptName() {
NBCLIOptions opts = new NBCLIOptions(new String[]{"script"});
assertThatExceptionOfType(InvalidParameterException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{"script"}));
}
@Test
@@ -140,10 +144,10 @@ public class TestNBCLIOptions {
}
@Test(expected = InvalidParameterException.class)
@Test
public void shouldThrowErrorForInvalidStopActivity() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "stop", "woah=woah" });
List<Cmd> cmds = opts.getCommands();
assertThatExceptionOfType(InvalidParameterException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "stop", "woah=woah" }));
}
@Test
@@ -155,11 +159,10 @@ public class TestNBCLIOptions {
}
@Test(expected = InvalidParameterException.class)
@Test
public void shouldThrowErrorForInvalidAwaitActivity() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "await", "awaitme=notvalid" });
List<Cmd> cmds = opts.getCommands();
assertThatExceptionOfType(InvalidParameterException.class)
.isThrownBy(() -> new NBCLIOptions(new String[]{ "await", "awaitme=notvalid" }));
}
@Test
@@ -174,27 +177,28 @@ public class TestNBCLIOptions {
@Test
public void listWorkloads() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "--list-workloads"});
List<Cmd> cmds = opts.getCommands();
assertThat(opts.wantsScenariosList());
assertThat(opts.wantsWorkloadsList()).isTrue();
}
@Test
public void listScenarios() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "--list-scenarios"});
assertThat(opts.wantsScenariosList()).isTrue();
}
@Test
public void listScripts() {
NBCLIOptions opts = new NBCLIOptions(new String[]{ "--list-scripts"});
List<Cmd> cmds = opts.getCommands();
assertThat(opts.wantsScriptList());
assertThat(opts.wantsScriptList()).isTrue();
}
@Test
public void clTest() {
String dir= "./";
URL resource = getClass().getClassLoader().getResource(dir);
assertThat(resource);
assertThat(resource).isNotNull();
Path basePath = NBIO.getFirstLocalPath(dir);
List<Path> yamlPathList = PathWalker.findAll(basePath).stream().filter(f -> f.toString().endsWith(".yaml")).collect(Collectors.toList());
assertThat(yamlPathList);
assertThat(yamlPathList).isNotEmpty();
}
}