use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class DefaultProgrammaticDriverConfigLoaderBuilderTest method should_honor_root_path.
@Test
public void should_honor_root_path() {
String rootPath = "test-root";
String propertyKey = rootPath + "." + DefaultDriverOption.CONNECTION_POOL_LOCAL_SIZE.getPath();
try {
System.setProperty(propertyKey, "42");
DriverConfigLoader loader = new DefaultProgrammaticDriverConfigLoaderBuilder(DefaultProgrammaticDriverConfigLoaderBuilder.DEFAULT_FALLBACK_SUPPLIER, rootPath).withInt(DefaultDriverOption.REQUEST_PAGE_SIZE, 1234).build();
DriverConfig config = loader.getInitialConfig();
assertThat(config.getDefaultProfile().getInt(DefaultDriverOption.CONNECTION_POOL_LOCAL_SIZE)).isEqualTo(42);
assertThat(config.getDefaultProfile().getInt(DefaultDriverOption.REQUEST_PAGE_SIZE)).isEqualTo(1234);
} finally {
System.clearProperty(propertyKey);
}
}
use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class DefaultProgrammaticDriverConfigLoaderBuilderTest method should_override_option_in_default_profile.
@Test
public void should_override_option_in_default_profile() {
DriverConfigLoader loader = new DefaultProgrammaticDriverConfigLoaderBuilder(() -> ConfigFactory.parseString(FALLBACK_CONFIG), "").withInt(MockOptions.INT1, 3).build();
DriverConfig config = loader.getInitialConfig();
assertThat(config.getDefaultProfile().getInt(MockOptions.INT1)).isEqualTo(3);
assertThat(config.getDefaultProfile().getInt(MockOptions.INT2)).isEqualTo(2);
}
use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class DefaultProgrammaticDriverConfigLoaderBuilderTest method should_override_option_in_existing_profile.
@Test
public void should_override_option_in_existing_profile() {
DriverConfigLoader loader = new DefaultProgrammaticDriverConfigLoaderBuilder(() -> ConfigFactory.parseString(FALLBACK_CONFIG), "").startProfile("profile1").withInt(MockOptions.INT1, 3).build();
DriverConfig config = loader.getInitialConfig();
assertThat(config.getDefaultProfile().getInt(MockOptions.INT1)).isEqualTo(1);
assertThat(config.getProfile("profile1").getInt(MockOptions.INT1)).isEqualTo(3);
}
use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class DefaultProgrammaticDriverConfigLoaderBuilderTest method should_handle_multiple_programmatic_profiles.
@Test
public void should_handle_multiple_programmatic_profiles() {
DriverConfigLoader loader = new DefaultProgrammaticDriverConfigLoaderBuilder(() -> ConfigFactory.parseString(FALLBACK_CONFIG), "").startProfile("profile2").withInt(MockOptions.INT1, 3).startProfile("profile3").withInt(MockOptions.INT1, 4).build();
DriverConfig config = loader.getInitialConfig();
assertThat(config.getProfile("profile2").getInt(MockOptions.INT1)).isEqualTo(3);
assertThat(config.getProfile("profile3").getInt(MockOptions.INT1)).isEqualTo(4);
}
use of com.datastax.oss.driver.api.core.config.DriverConfig in project java-driver by datastax.
the class GraphSupportCheckerTest method contextGraphPagingEnabled.
private void contextGraphPagingEnabled(InternalDriverContext context, PagingEnabledOptions option) {
DriverExecutionProfile driverExecutionProfile = mock(DriverExecutionProfile.class);
when(driverExecutionProfile.getString(DseDriverOption.GRAPH_PAGING_ENABLED)).thenReturn(option.name());
DriverConfig config = mock(DriverConfig.class);
when(context.getConfig()).thenReturn(config);
when(config.getDefaultProfile()).thenReturn(driverExecutionProfile);
}
Aggregations