Revert "Merge pull request #1933 from cognitree/invalid-driver"

This reverts commit d45b5c0ced, reversing
changes made to 95a31ce73d.
This commit is contained in:
Jonathan Shook 2024-10-02 15:31:55 -05:00
parent d45b5c0ced
commit 73824aa3c6
2 changed files with 0 additions and 17 deletions

View File

@ -16,10 +16,8 @@
package io.nosqlbench.engine.core.lifecycle.session; package io.nosqlbench.engine.core.lifecycle.session;
import io.nosqlbench.adapter.diag.DriverAdapterLoader;
import io.nosqlbench.engine.cmdstream.Cmd; import io.nosqlbench.engine.cmdstream.Cmd;
import io.nosqlbench.engine.cmdstream.CmdArg; import io.nosqlbench.engine.cmdstream.CmdArg;
import io.nosqlbench.nb.annotations.ServiceSelector;
import io.nosqlbench.nb.api.errors.BasicError; import io.nosqlbench.nb.api.errors.BasicError;
import java.util.*; import java.util.*;
@ -77,14 +75,6 @@ public class CmdParser {
if (params.containsKey(param.name())) { if (params.containsKey(param.name())) {
throw new BasicError("Duplicate occurrence of option: " + param.name()); throw new BasicError("Duplicate occurrence of option: " + param.name());
} }
if (Objects.equals(param.name(), "driver")) {
String driverName = param.value();
Optional<? extends DriverAdapterLoader> driverAdapter =
ServiceSelector.of(driverName, ServiceLoader.load(DriverAdapterLoader.class)).get();
if (driverAdapter.isEmpty()) {
throw new BasicError("Unable to load default driver adapter '" + driverName + '\'');
}
}
params.put(param.name(),CmdArg.of(cmd.name(),param.name(),param.op(),param.value())); params.put(param.name(),CmdArg.of(cmd.name(),param.name(),param.op(),param.value()));
} }
cmds.add(new Cmd(cmd.name(),params)); cmds.add(new Cmd(cmd.name(),params));

View File

@ -106,11 +106,4 @@ class CmdParserTest {
.withMessageContaining("Duplicate occurrence of option: threads"); .withMessageContaining("Duplicate occurrence of option: threads");
} }
@Test
public void testNonExistentDriverThrowsError() {
assertThatExceptionOfType(BasicError.class)
.isThrownBy(() -> CmdParser.parseArgvCommands(new LinkedList<>(List.of("run", "driver=nonexistant"))))
.withMessageContaining("Unable to load default driver adapter 'nonexistant'");
}
} }