use of com.datastax.oss.driver.api.core.config.OptionsMap in project java-driver by datastax.
the class CompositeDriverConfigTest method setup.
@Before
public void setup() {
primaryMap = new OptionsMap();
// We need at least one option so that the default profile exists. Do it now to avoid having to
// do it in every test. We use an option that we won't reuse in the tests so that there are no
// unwanted interactions.
primaryMap.put(TypedDriverOption.CONTINUOUS_PAGING_MAX_PAGES, 1);
fallbackMap = new OptionsMap();
fallbackMap.put(TypedDriverOption.CONTINUOUS_PAGING_MAX_PAGES, 1);
DriverConfigLoader compositeLoader = DriverConfigLoader.compose(DriverConfigLoader.fromMap(primaryMap), DriverConfigLoader.fromMap(fallbackMap));
compositeConfig = compositeLoader.getInitialConfig();
compositeDefaultProfile = compositeConfig.getDefaultProfile();
}
use of com.datastax.oss.driver.api.core.config.OptionsMap in project java-driver by datastax.
the class MapBasedDriverConfigTest method should_create_derived_profile_overriding_option.
@Test
public void should_create_derived_profile_overriding_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.INT1, 43);
assertThat(base.getInt(MockOptions.INT1)).isEqualTo(42);
assertThat(derived.getInt(MockOptions.INT1)).isEqualTo(43);
}
use of com.datastax.oss.driver.api.core.config.OptionsMap in project java-driver by datastax.
the class MapBasedDriverConfigTest method should_create_derived_profile_unsetting_option.
@Test
public void should_create_derived_profile_unsetting_option() {
OptionsMap source = new OptionsMap();
source.put(MockTypedOptions.INT1, 42);
source.put(MockTypedOptions.INT2, 43);
DriverConfig config = DriverConfigLoader.fromMap(source).getInitialConfig();
DriverExecutionProfile base = config.getDefaultProfile();
DriverExecutionProfile derived = base.without(MockOptions.INT2);
assertThat(base.getInt(MockOptions.INT2)).isEqualTo(43);
assertThat(derived.isDefined(MockOptions.INT2)).isFalse();
}
Aggregations