Search in sources :

Example 1 with Startup

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);
}
Also used : Startup(com.datastax.oss.protocol.internal.request.Startup) DataProvider(com.tngtech.java.junit.dataprovider.DataProvider) Test(org.junit.Test)

Example 2 with 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);
}
Also used : Startup(com.datastax.oss.protocol.internal.request.Startup) Test(org.junit.Test)

Example 3 with 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);
}
Also used : Startup(com.datastax.oss.protocol.internal.request.Startup) Test(org.junit.Test)

Example 4 with 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);
}
Also used : UUID(java.util.UUID) Startup(com.datastax.oss.protocol.internal.request.Startup) Test(org.junit.Test)

Example 5 with 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);
}
Also used : Startup(com.datastax.oss.protocol.internal.request.Startup) Test(org.junit.Test)

Aggregations

Startup (com.datastax.oss.protocol.internal.request.Startup)11 Test (org.junit.Test)11 DataProvider (com.tngtech.java.junit.dataprovider.DataProvider)2 UUID (java.util.UUID)2