use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project java-driver by datastax.
the class TypesafeDriverConfigTest method should_create_derived_profile_unsetting_option.
@Test
public void should_create_derived_profile_unsetting_option() {
TypesafeDriverConfig config = parse("int1 = 42\n int2 = 43");
DriverExecutionProfile base = config.getDefaultProfile();
DriverExecutionProfile derived = base.without(MockOptions.INT2);
assertThat(base.getInt(MockOptions.INT2)).isEqualTo(43);
assertThat(derived.isDefined(MockOptions.INT2)).isFalse();
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project java-driver by datastax.
the class TypesafeDriverConfigTest method should_create_derived_profile_with_new_option.
@Test
public void should_create_derived_profile_with_new_option() {
TypesafeDriverConfig config = parse("int1 = 42");
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.DriverExecutionProfile in project java-driver by datastax.
the class TypesafeDriverConfigTest method should_update_derived_profiles_after_reloading.
@Test
public void should_update_derived_profiles_after_reloading() {
TypesafeDriverConfig config = parse("int1 = 42\n profiles { profile1 { int1 = 43 } }");
DriverExecutionProfile derivedFromDefault = config.getDefaultProfile().withInt(MockOptions.INT2, 50);
DriverExecutionProfile derivedFromProfile1 = config.getProfile("profile1").withInt(MockOptions.INT2, 51);
config.reload(ConfigFactory.parseString("int1 = 44\n profiles { profile1 { int1 = 45 } }"));
assertThat(derivedFromDefault.getInt(MockOptions.INT1)).isEqualTo(44);
assertThat(derivedFromDefault.getInt(MockOptions.INT2)).isEqualTo(50);
assertThat(derivedFromProfile1.getInt(MockOptions.INT1)).isEqualTo(45);
assertThat(derivedFromProfile1.getInt(MockOptions.INT2)).isEqualTo(51);
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project java-driver by datastax.
the class DefaultDriverContextTest method buildMockedContext.
private DefaultDriverContext buildMockedContext(Optional<String> compressionOption) {
DriverExecutionProfile defaultProfile = mock(DriverExecutionProfile.class);
when(defaultProfile.getString(DefaultDriverOption.PROTOCOL_COMPRESSION, "none")).thenReturn(compressionOption.orElse("none"));
return MockedDriverContextFactory.defaultDriverContext(Optional.of(defaultProfile));
}
use of com.datastax.oss.driver.api.core.config.DriverExecutionProfile in project java-driver by datastax.
the class StartupOptionsBuilderTest method buildMockedContext.
private DefaultDriverContext buildMockedContext(String compression) {
DriverExecutionProfile defaultProfile = mock(DriverExecutionProfile.class);
when(defaultProfile.getString(DefaultDriverOption.PROTOCOL_COMPRESSION, "none")).thenReturn(compression);
return MockedDriverContextFactory.defaultDriverContext(Optional.of(defaultProfile));
}
Aggregations