Skip to content

Verifies that the CassandraProperties default values are the same as driver built-in defaults #25130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.springframework.boot.autoconfigure.cassandra;

import com.datastax.oss.driver.api.core.config.OptionsMap;
import com.datastax.oss.driver.api.core.config.TypedDriverOption;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
* Tests for {@link CassandraProperties}.
*
* @author Chris Bono
*/
class CassandraPropertiesTest {

@Test
void defaultValuesAreConsistent() {
CassandraProperties properties = new CassandraProperties();
OptionsMap optionsMap = OptionsMap.driverDefaults();

assertThat(properties.getConnection().getConnectTimeout())
.isEqualTo(optionsMap.get(TypedDriverOption.CONNECTION_CONNECT_TIMEOUT));

assertThat(properties.getConnection().getInitQueryTimeout())
.isEqualTo(optionsMap.get(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT));

assertThat(properties.getRequest().getTimeout()).isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_TIMEOUT));

assertThat(properties.getRequest().getPageSize())
.isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_PAGE_SIZE));

assertThat(properties.getRequest().getThrottler().getType().type())
.isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_THROTTLER_CLASS));

assertThat(properties.getPool().getHeartbeatInterval())
.isEqualTo(optionsMap.get(TypedDriverOption.HEARTBEAT_INTERVAL));
}

}