Polish "Validate Cassandra defaults"

See gh-25130
This commit is contained in:
Stephane Nicoll 2021-02-10 10:15:15 +01:00
parent f71ab69aeb
commit e5098697cb

View File

@ -1,3 +1,19 @@
/*
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.cassandra;
import com.datastax.oss.driver.api.core.config.OptionsMap;
@ -16,24 +32,19 @@ class CassandraPropertiesTest {
@Test
void defaultValuesAreConsistent() {
CassandraProperties properties = new CassandraProperties();
OptionsMap optionsMap = OptionsMap.driverDefaults();
OptionsMap driverDefaults = OptionsMap.driverDefaults();
assertThat(properties.getConnection().getConnectTimeout())
.isEqualTo(optionsMap.get(TypedDriverOption.CONNECTION_CONNECT_TIMEOUT));
.isEqualTo(driverDefaults.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));
.isEqualTo(driverDefaults.get(TypedDriverOption.CONNECTION_INIT_QUERY_TIMEOUT));
assertThat(properties.getRequest().getTimeout())
.isEqualTo(driverDefaults.get(TypedDriverOption.REQUEST_TIMEOUT));
assertThat(properties.getRequest().getPageSize())
.isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_PAGE_SIZE));
.isEqualTo(driverDefaults.get(TypedDriverOption.REQUEST_PAGE_SIZE));
assertThat(properties.getRequest().getThrottler().getType().type())
.isEqualTo(optionsMap.get(TypedDriverOption.REQUEST_THROTTLER_CLASS));
.isEqualTo(driverDefaults.get(TypedDriverOption.REQUEST_THROTTLER_CLASS));
assertThat(properties.getPool().getHeartbeatInterval())
.isEqualTo(optionsMap.get(TypedDriverOption.HEARTBEAT_INTERVAL));
.isEqualTo(driverDefaults.get(TypedDriverOption.HEARTBEAT_INTERVAL));
}
}