Skip to content

Commit b2258b8

Browse files
committed
Merge pull request #25130 from bono007
* pr/25130: Polish "Validate Cassandra defaults" Validate Cassandra defaults Closes gh-25130
2 parents 166d9b1 + e509869 commit b2258b8

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright 2012-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.autoconfigure.cassandra;
18+
19+
import com.datastax.oss.driver.api.core.config.OptionsMap;
20+
import com.datastax.oss.driver.api.core.config.TypedDriverOption;
21+
import org.junit.jupiter.api.Test;
22+
23+
import static org.assertj.core.api.Assertions.assertThat;
24+
25+
/**
26+
* Tests for {@link CassandraProperties}.
27+
*
28+
* @author Chris Bono
29+
*/
30+
class CassandraPropertiesTest {
31+
32+
@Test
33+
void defaultValuesAreConsistent() {
34+
CassandraProperties properties = new CassandraProperties();
35+
OptionsMap driverDefaults = OptionsMap.driverDefaults();
36+
assertThat(properties.getConnection().getConnectTimeout())
37+
.isEqualTo(driverDefaults.get(TypedDriverOption.CONNECTION_CONNECT_TIMEOUT));
38+
assertThat(properties.getConnection().getInitQueryTimeout())
39+
.isEqualTo(driverDefaults.get(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT));
40+
assertThat(properties.getRequest().getTimeout())
41+
.isEqualTo(driverDefaults.get(TypedDriverOption.REQUEST_TIMEOUT));
42+
assertThat(properties.getRequest().getPageSize())
43+
.isEqualTo(driverDefaults.get(TypedDriverOption.REQUEST_PAGE_SIZE));
44+
assertThat(properties.getRequest().getThrottler().getType().type())
45+
.isEqualTo(driverDefaults.get(TypedDriverOption.REQUEST_THROTTLER_CLASS));
46+
assertThat(properties.getPool().getHeartbeatInterval())
47+
.isEqualTo(driverDefaults.get(TypedDriverOption.HEARTBEAT_INTERVAL));
48+
}
49+
50+
}

0 commit comments

Comments
 (0)