use of io.nosqlbench.nb.api.config.standard.NBConfiguration in project nosqlbench by nosqlbench.
the class ConfigModelTest method testMultipleParams.
@Test
public void testMultipleParams() {
ConfigModel cm = ConfigModel.of(ConfigModelTest.class, Param.defaultTo(List.of("a", "b"), "value").setRequired(false), Param.required("c", int.class));
NBConfiguration cfg = cm.apply(Map.of("c", 232));
assertThat(cfg.getOptional("a")).isEmpty();
assertThat(cfg.get("c", int.class)).isEqualTo(232);
}
use of io.nosqlbench.nb.api.config.standard.NBConfiguration in project nosqlbench by nosqlbench.
the class ActivityTypeLoader method getDriverAdapter.
private Optional<ActivityType> getDriverAdapter(String activityTypeName, ActivityDef activityDef) {
Optional<DriverAdapter> oda = DRIVERADAPTER_SPI_FINDER.getOptionally(activityTypeName);
if (oda.isPresent()) {
DriverAdapter<?, ?> driverAdapter = oda.get();
activityDef.getParams().remove("driver");
if (driverAdapter instanceof NBConfigurable) {
NBConfigModel cfgModel = ((NBConfigurable) driverAdapter).getConfigModel();
Optional<String> op_yaml_loc = activityDef.getParams().getOptionalString("yaml", "workload");
if (op_yaml_loc.isPresent()) {
Map<String, Object> disposable = new LinkedHashMap<>(activityDef.getParams());
StmtsDocList workload = StatementsLoader.loadPath(logger, op_yaml_loc.get(), disposable, "activities");
cfgModel = cfgModel.add(workload.getConfigModel());
}
NBConfiguration cfg = cfgModel.apply(activityDef.getParams());
((NBConfigurable) driverAdapter).applyConfig(cfg);
}
ActivityType activityType = new StandardActivityType<>(driverAdapter, activityDef);
return Optional.of(activityType);
} else {
return Optional.empty();
}
}
use of io.nosqlbench.nb.api.config.standard.NBConfiguration in project nosqlbench by nosqlbench.
the class DynamoDBDriverAdapter method getOpMapper.
@Override
public OpMapper<DynamoDBOp> getOpMapper() {
DriverSpaceCache<? extends DynamoDBSpace> spaceCache = getSpaceCache();
NBConfiguration adapterConfig = getConfiguration();
return new DynamoDBOpMapper(adapterConfig, spaceCache);
}
use of io.nosqlbench.nb.api.config.standard.NBConfiguration in project nosqlbench by nosqlbench.
the class SSLKsFactoryTest method testOpenSSLGetContextWithMissingCertError.
@Test
public void testOpenSSLGetContextWithMissingCertError() {
String[] params = { "ssl=openssl", "caCertFilePath=src/test/resources/ssl/cacert.crt", "keyFilePath=src/test/resources/ssl/client.key" };
ActivityDef activityDef = ActivityDef.parseActivityDef(String.join(";", params));
NBConfiguration sslCfg = SSLKsFactory.get().getConfigModel().extractConfig(activityDef.getParams());
assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> SSLKsFactory.get().getContext(sslCfg)).withMessageContaining("Unable to load key from").withCauseInstanceOf(IllegalArgumentException.class);
}
use of io.nosqlbench.nb.api.config.standard.NBConfiguration in project nosqlbench by nosqlbench.
the class SSLKsFactoryTest method testJdkGetContextWithTruststoreAndKeystoreAndDifferentKeyPassword.
@Test
public void testJdkGetContextWithTruststoreAndKeystoreAndDifferentKeyPassword() {
String[] params = { "ssl=jdk", "truststore=src/test/resources/ssl/server_truststore.p12", "tspass=nosqlbench_server", "keystore=src/test/resources/ssl/client_diff_password.p12", "kspass=nosqlbench_client", "keyPassword=nosqlbench" };
ActivityDef activityDef = ActivityDef.parseActivityDef(String.join(";", params));
NBConfiguration sslCfg = SSLKsFactory.get().getConfigModel().extractConfig(activityDef.getParams());
assertThat(SSLKsFactory.get().getContext(sslCfg)).isNotNull();
}
Aggregations