|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2020 the original author or authors.
|
|
|
|
* Copyright 2012-2021 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
import com.mongodb.MongoClientSettings;
|
|
|
|
import com.mongodb.MongoClientSettings;
|
|
|
|
import com.mongodb.client.MongoClient;
|
|
|
|
import com.mongodb.client.MongoClient;
|
|
|
|
import com.mongodb.client.MongoClients;
|
|
|
|
import com.mongodb.client.MongoClients;
|
|
|
|
|
|
|
|
import com.mongodb.client.internal.MongoClientImpl;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
|
|
|
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
|
|
@ -28,7 +29,6 @@ import org.springframework.boot.test.context.assertj.AssertableApplicationContex
|
|
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
|
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.test.util.ReflectionTestUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
|
|
|
|
|
|
@ -86,8 +86,8 @@ class MongoAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
private MongoClientSettings getSettings(AssertableApplicationContext context) {
|
|
|
|
private MongoClientSettings getSettings(AssertableApplicationContext context) {
|
|
|
|
assertThat(context).hasSingleBean(MongoClient.class);
|
|
|
|
assertThat(context).hasSingleBean(MongoClient.class);
|
|
|
|
MongoClient client = context.getBean(MongoClient.class);
|
|
|
|
MongoClientImpl client = (MongoClientImpl) context.getBean(MongoClient.class);
|
|
|
|
return (MongoClientSettings) ReflectionTestUtils.getField(client, "settings");
|
|
|
|
return client.getSettings();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|