use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class MapBasedDriverConfigTest method should_override_option_in_profile.
@Test
public void should_override_option_in_profile() {
OptionsMap source = new OptionsMap();
source.put(MockTypedOptions.INT1, 42);
source.put("profile1", MockTypedOptions.INT1, 43);
DriverConfig config = DriverConfigLoader.fromMap(source).getInitialConfig();
assertThat(config).hasIntOption(MockOptions.INT1, 42).hasIntOption("profile1", MockOptions.INT1, 43);
}
use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class MapBasedDriverConfigTest method should_create_derived_profile_with_new_option.
@Test
public void should_create_derived_profile_with_new_option() {
OptionsMap source = new OptionsMap();
source.put(MockTypedOptions.INT1, 42);
DriverConfig config = DriverConfigLoader.fromMap(source).getInitialConfig();
DriverExecutionProfile base = config.getDefaultProfile();
DriverExecutionProfile derived = base.withInt(MockOptions.INT2, 43);
assertThat(base.isDefined(MockOptions.INT2)).isFalse();
assertThat(derived.isDefined(MockOptions.INT2)).isTrue();
assertThat(derived.getInt(MockOptions.INT2)).isEqualTo(43);
}
use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class MapBasedDriverConfigTest method should_load_minimal_config_with_no_profiles.
@Test
public void should_load_minimal_config_with_no_profiles() {
OptionsMap source = new OptionsMap();
source.put(MockTypedOptions.INT1, 42);
DriverConfig config = DriverConfigLoader.fromMap(source).getInitialConfig();
assertThat(config).hasIntOption(MockOptions.INT1, 42);
}
use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class DefaultDriverConfigLoaderTest method should_build_initial_config.
@Test
public void should_build_initial_config() {
DefaultDriverConfigLoader loader = new DefaultDriverConfigLoader(() -> ConfigFactory.parseString(configSource.get()));
DriverConfig initialConfig = loader.getInitialConfig();
assertThat(initialConfig).hasIntOption(MockOptions.INT1, 42);
}
use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class DefaultDriverConfigLoaderTest method should_not_notify_from_manual_reload_if_config_has_not_changed.
@Test
public void should_not_notify_from_manual_reload_if_config_has_not_changed() {
DefaultDriverConfigLoader loader = new DefaultDriverConfigLoader(() -> ConfigFactory.parseString(configSource.get()));
DriverConfig initialConfig = loader.getInitialConfig();
assertThat(initialConfig).hasIntOption(MockOptions.INT1, 42);
loader.onDriverInit(context);
adminExecutor.waitForNonScheduledTasks();
CompletionStage<Boolean> reloaded = loader.reload();
adminExecutor.waitForNonScheduledTasks();
verify(eventBus, never()).fire(ConfigChangeEvent.INSTANCE);
assertThatStage(reloaded).isSuccess(changed -> assertThat(changed).isFalse());
}
Aggregations