This commit is contained in:
Phillip Webb
2020-04-07 12:10:49 -07:00
parent 1640add8be
commit 3ca896e63f
28 changed files with 66 additions and 73 deletions

View File

@@ -20,8 +20,10 @@ import com.couchbase.client.java.env.ClusterEnvironment;
/**
* Callback interface that can be implemented by beans wishing to customize the
* {@link ClusterEnvironment} via a {@link ClusterEnvironment.Builder} whilst retaining
* default auto-configuration.whilst retaining default auto-configuration.
* {@link ClusterEnvironment} via a
* {@link com.couchbase.client.java.env.ClusterEnvironment.Builder
* ClusterEnvironment.Builder} whilst retaining default auto-configuration.whilst
* retaining default auto-configuration.
*
* @author Stephane Nicoll
* @since 2.3.0
@@ -30,7 +32,8 @@ import com.couchbase.client.java.env.ClusterEnvironment;
public interface ClusterEnvironmentBuilderCustomizer {
/**
* Customize the {@link ClusterEnvironment.Builder}.
* Customize the {@link com.couchbase.client.java.env.ClusterEnvironment.Builder
* ClusterEnvironment.Builder}.
* @param builder the builder to customize
*/
void customize(ClusterEnvironment.Builder builder);

View File

@@ -33,6 +33,7 @@ import org.springframework.util.Assert;
/**
* Base class for setup that is common to MongoDB client factories.
*
* @param <T> the mongo client type
* @author Christoph Strobl
* @author Scott Frederick
* @since 2.3.0

View File

@@ -136,8 +136,8 @@ public final class ConnectionFactoryBuilder {
static class ConnectionFactoryOptionsInitializer {
/**
* Initialize a {@link ConnectionFactoryOptions.Builder} using the specified
* properties.
* Initialize a {@link io.r2dbc.spi.ConnectionFactoryOptions.Builder
* ConnectionFactoryOptions.Builder} using the specified properties.
* @param properties the properties to use to initialize the builder
* @param embeddedDatabaseConnection the embedded connection to use as a fallback
* @return an initialized builder

View File

@@ -169,6 +169,7 @@ public class UndertowWebServerFactoryCustomizer
return (value) -> this.factory.addBuilderCustomizers((builder) -> builder.setSocketOption(option, value));
}
@SuppressWarnings("unchecked")
<T> Consumer<Map<String, String>> forEach(Function<Option<T>, Consumer<T>> function) {
return (map) -> map.forEach((key, value) -> {
Option<T> option = (Option<T>) NAME_LOOKUP.get(getCanonicalName(key));

View File

@@ -19,9 +19,6 @@ package org.springframework.boot.autoconfigure.web.format;
import java.time.format.DateTimeFormatter;
import java.time.format.ResolverStyle;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.format.datetime.DateFormatterRegistrar;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
@@ -49,8 +46,6 @@ public class WebConversionService extends DefaultFormattingConversionService {
private static final boolean JSR_354_PRESENT = ClassUtils.isPresent("javax.money.MonetaryAmount",
WebConversionService.class.getClassLoader());
private static final Log logger = LogFactory.getLog(WebConversionService.class);
private final String dateFormat;
/**

View File

@@ -64,6 +64,7 @@ import static org.testcontainers.shaded.org.apache.commons.codec.binary.Base64.e
* Temporary copy of TestContainers's Couchbase support until it works against Couchbase
* SDK v3.
*/
@SuppressWarnings("resource")
class CouchbaseContainer extends GenericContainer<CouchbaseContainer> {
public static final String VERSION = "5.5.1";
@@ -198,7 +199,6 @@ class CouchbaseContainer extends GenericContainer<CouchbaseContainer> {
}
@Override
@SuppressWarnings({ "unchecked", "ConstantConditions" })
public void stop() {
try {
stopCluster();

View File

@@ -667,6 +667,7 @@ class KafkaAutoConfigurationTests {
@Configuration(proxyBeanMethods = false)
static class ConsumerFactoryConfiguration {
@SuppressWarnings("unchecked")
private final ConsumerFactory<String, Object> consumerFactory = mock(ConsumerFactory.class);
@Bean

View File

@@ -42,6 +42,7 @@ import static org.mockito.Mockito.verify;
/**
* Tests for {@link MongoClientFactorySupport}.
*
* @param <T> the mongo client type
* @author Phillip Webb
* @author Andy Wilkinson
* @author Stephane Nicoll

View File

@@ -167,10 +167,8 @@ class R2dbcAutoConfigurationTests {
this.contextRunner.withPropertyValues("spring.r2dbc.pool.enabled=false", "spring.r2dbc.url:r2dbc:simple://foo",
"spring.r2dbc.properties.test=value", "spring.r2dbc.properties.another=2").run((context) -> {
SimpleTestConnectionFactory connectionFactory = context.getBean(SimpleTestConnectionFactory.class);
assertThat((Object) connectionFactory.options.getRequiredValue(Option.valueOf("test")))
.isEqualTo("value");
assertThat((Object) connectionFactory.options.getRequiredValue(Option.valueOf("another")))
.isEqualTo("2");
assertThat(getRequiredOptionsValue(connectionFactory, "test")).isEqualTo("value");
assertThat(getRequiredOptionsValue(connectionFactory, "another")).isEqualTo("2");
});
}
@@ -181,13 +179,15 @@ class R2dbcAutoConfigurationTests {
assertThat(context).hasSingleBean(ConnectionFactory.class).hasSingleBean(ConnectionPool.class);
SimpleTestConnectionFactory connectionFactory = (SimpleTestConnectionFactory) context
.getBean(ConnectionPool.class).unwrap();
assertThat((Object) connectionFactory.options.getRequiredValue(Option.valueOf("test")))
.isEqualTo("value");
assertThat((Object) connectionFactory.options.getRequiredValue(Option.valueOf("another")))
.isEqualTo("2");
assertThat(getRequiredOptionsValue(connectionFactory, "test")).isEqualTo("value");
assertThat(getRequiredOptionsValue(connectionFactory, "another")).isEqualTo("2");
});
}
private Object getRequiredOptionsValue(SimpleTestConnectionFactory connectionFactory, String name) {
return connectionFactory.options.getRequiredValue(Option.valueOf(name));
}
@Test
void configureWithoutUrlShouldCreateEmbeddedConnectionPoolByDefault() {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(ConnectionFactory.class)

View File

@@ -350,7 +350,7 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
.run((context) -> {
assertThat(context).hasSingleBean(ReactiveJwtDecoder.class);
ReactiveJwtDecoder reactiveJwtDecoder = context.getBean(ReactiveJwtDecoder.class);
DelegatingOAuth2TokenValidator<Jwt> jwtValidator = (DelegatingOAuth2TokenValidator) ReflectionTestUtils
DelegatingOAuth2TokenValidator<Jwt> jwtValidator = (DelegatingOAuth2TokenValidator<Jwt>) ReflectionTestUtils
.getField(reactiveJwtDecoder, "jwtValidator");
Collection<OAuth2TokenValidator<Jwt>> tokenValidators = (Collection<OAuth2TokenValidator<Jwt>>) ReflectionTestUtils
.getField(jwtValidator, "tokenValidators");

View File

@@ -338,7 +338,7 @@ class OAuth2ResourceServerAutoConfigurationTests {
.run((context) -> {
assertThat(context).hasSingleBean(JwtDecoder.class);
JwtDecoder jwtDecoder = context.getBean(JwtDecoder.class);
DelegatingOAuth2TokenValidator<Jwt> jwtValidator = (DelegatingOAuth2TokenValidator) ReflectionTestUtils
DelegatingOAuth2TokenValidator<Jwt> jwtValidator = (DelegatingOAuth2TokenValidator<Jwt>) ReflectionTestUtils
.getField(jwtDecoder, "jwtValidator");
Collection<OAuth2TokenValidator<Jwt>> tokenValidators = (Collection<OAuth2TokenValidator<Jwt>>) ReflectionTestUtils
.getField(jwtValidator, "tokenValidators");