use of com.datastax.oss.protocol.internal.request.Startup in project java-driver by datastax.
the class StartupOptionsBuilderTest method should_build_startup_options.
@Test
@DataProvider({ "lz4", "snappy" })
public void should_build_startup_options(String compression) {
DefaultDriverContext ctx = buildMockedContext(compression);
Startup startup = new Startup(ctx.getStartupOptions());
// assert the compression option is present
assertThat(startup.options).containsEntry(Startup.COMPRESSION_KEY, compression);
assertDefaultStartupOptions(startup);
}
use of com.datastax.oss.protocol.internal.request.Startup in project java-driver by datastax.
the class StartupOptionsBuilderTest method should_build_startup_options_with_no_compression_if_undefined.
@Test
public void should_build_startup_options_with_no_compression_if_undefined() {
DefaultDriverContext ctx = MockedDriverContextFactory.defaultDriverContext();
Startup startup = new Startup(ctx.getStartupOptions());
assertThat(startup.options).doesNotContainKey(Startup.COMPRESSION_KEY);
assertDefaultStartupOptions(startup);
}
use of com.datastax.oss.protocol.internal.request.Startup in project java-driver by datastax.
the class StartupOptionsBuilderTest method should_build_startup_options_with_no_compression_if_defined_as_none.
@Test
public void should_build_startup_options_with_no_compression_if_defined_as_none() {
DefaultDriverContext ctx = buildMockedContext("none");
Startup startup = new Startup(ctx.getStartupOptions());
assertThat(startup.options).doesNotContainKey(Startup.COMPRESSION_KEY);
assertDefaultStartupOptions(startup);
}
use of com.datastax.oss.protocol.internal.request.Startup in project java-driver by datastax.
the class DseStartupOptionsBuilderTest method should_build_startup_options_with_all_options.
@Test
public void should_build_startup_options_with_all_options() {
// mock config to specify "snappy" compression
when(defaultProfile.getString(DefaultDriverOption.PROTOCOL_COMPRESSION, "none")).thenReturn("snappy");
UUID customClientId = Uuids.random();
buildContext(customClientId, "Custom_App_Name", "Custom_App_Version");
Startup startup = new Startup(driverContext.getStartupOptions());
assertThat(startup.options).containsEntry(StartupOptionsBuilder.CLIENT_ID_KEY, customClientId.toString()).containsEntry(StartupOptionsBuilder.APPLICATION_NAME_KEY, "Custom_App_Name").containsEntry(StartupOptionsBuilder.APPLICATION_VERSION_KEY, "Custom_App_Version");
assertThat(startup.options).containsEntry(Startup.COMPRESSION_KEY, "snappy");
assertDefaultStartupOptions(startup);
}
use of com.datastax.oss.protocol.internal.request.Startup in project java-driver by datastax.
the class DseStartupOptionsBuilderTest method should_build_startup_options_with_no_compression_if_undefined.
@Test
public void should_build_startup_options_with_no_compression_if_undefined() {
when(defaultProfile.getString(DefaultDriverOption.PROTOCOL_COMPRESSION, "none")).thenReturn("none");
buildContext(null, null, null);
Startup startup = new Startup(driverContext.getStartupOptions());
assertThat(startup.options).doesNotContainKey(Startup.COMPRESSION_KEY);
assertDefaultStartupOptions(startup);
}
Aggregations