Skip to content

Commit f71ab69

Browse files
onobcsnicoll
authored andcommitted
Validate Cassandra defaults
See gh-25130
1 parent 166d9b1 commit f71ab69

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package org.springframework.boot.autoconfigure.cassandra;
2+
3+
import com.datastax.oss.driver.api.core.config.OptionsMap;
4+
import com.datastax.oss.driver.api.core.config.TypedDriverOption;
5+
import org.junit.jupiter.api.Test;
6+
7+
import static org.assertj.core.api.Assertions.assertThat;
8+
9+
/**
10+
* Tests for {@link CassandraProperties}.
11+
*
12+
* @author Chris Bono
13+
*/
14+
class CassandraPropertiesTest {
15+
16+
@Test
17+
void defaultValuesAreConsistent() {
18+
CassandraProperties properties = new CassandraProperties();
19+
OptionsMap optionsMap = OptionsMap.driverDefaults();
20+
21+
assertThat(properties.getConnection().getConnectTimeout())
22+
.isEqualTo(optionsMap.get(TypedDriverOption.CONNECTION_CONNECT_TIMEOUT));
23+
24+
assertThat(properties.getConnection().getInitQueryTimeout())
25+
.isEqualTo(optionsMap.get(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT));
26+
27+
assertThat(properties.getRequest().getTimeout()).isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_TIMEOUT));
28+
29+
assertThat(properties.getRequest().getPageSize())
30+
.isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_PAGE_SIZE));
31+
32+
assertThat(properties.getRequest().getThrottler().getType().type())
33+
.isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_THROTTLER_CLASS));
34+
35+
assertThat(properties.getPool().getHeartbeatInterval())
36+
.isEqualTo(optionsMap.get(TypedDriverOption.HEARTBEAT_INTERVAL));
37+
}
38+
39+
}

0 commit comments

Comments
 (0)