Merge branch '3.0.x'

Closes gh-35610
pull/35621/head
Scott Frederick 2 years ago
commit 703883d302

@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 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.
@ -61,7 +61,7 @@ abstract class ElasticsearchDataConfiguration {
@Bean
@ConditionalOnMissingBean
SimpleElasticsearchMappingContext mappingContext(ApplicationContext applicationContext,
SimpleElasticsearchMappingContext elasticsearchMappingContext(ApplicationContext applicationContext,
ElasticsearchCustomConversions elasticsearchCustomConversions) throws ClassNotFoundException {
SimpleElasticsearchMappingContext mappingContext = new SimpleElasticsearchMappingContext();
mappingContext.setInitialEntitySet(new EntityScanner(applicationContext).scan(Document.class));

@ -35,6 +35,7 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.elc.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.config.EnableElasticsearchAuditing;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
import static org.assertj.core.api.Assertions.assertThat;
@ -45,6 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Phillip Webb
* @author Andy Wilkinson
* @author Brian Clozel
* @author Scott Frederick
*/
@Testcontainers(disabledWithoutDocker = true)
class ElasticsearchRepositoriesAutoConfigurationTests {
@ -80,6 +82,12 @@ class ElasticsearchRepositoriesAutoConfigurationTests {
.run((context) -> assertThat(context).hasSingleBean(CityElasticsearchDbRepository.class));
}
@Test
void testAuditingConfiguration() {
this.contextRunner.withUserConfiguration(AuditingConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(ElasticsearchTemplate.class));
}
@Configuration(proxyBeanMethods = false)
@TestAutoConfigurationPackage(City.class)
static class TestConfiguration {
@ -99,4 +107,12 @@ class ElasticsearchRepositoriesAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@TestAutoConfigurationPackage(ElasticsearchRepositoriesAutoConfigurationTests.class)
@EnableElasticsearchRepositories
@EnableElasticsearchAuditing
static class AuditingConfiguration {
}
}

@ -38,6 +38,7 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.boot.testsupport.testcontainers.DockerImageNames;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.elc.ReactiveElasticsearchTemplate;
import org.springframework.data.elasticsearch.config.EnableElasticsearchAuditing;
import org.springframework.data.elasticsearch.repository.config.EnableReactiveElasticsearchRepositories;
import static org.assertj.core.api.Assertions.assertThat;
@ -48,6 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Phillip Webb
* @author Andy Wilkinson
* @author Brian Clozel
* @author Scott Frederick
*/
@Testcontainers(disabledWithoutDocker = true)
class ReactiveElasticsearchRepositoriesAutoConfigurationTests {
@ -87,6 +89,12 @@ class ReactiveElasticsearchRepositoriesAutoConfigurationTests {
.run((context) -> assertThat(context).hasSingleBean(CityReactiveElasticsearchDbRepository.class));
}
@Test
void testAuditingConfiguration() {
this.contextRunner.withUserConfiguration(AuditingConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(ReactiveElasticsearchTemplate.class));
}
@Configuration(proxyBeanMethods = false)
@TestAutoConfigurationPackage(City.class)
static class TestConfiguration {
@ -106,4 +114,12 @@ class ReactiveElasticsearchRepositoriesAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@TestAutoConfigurationPackage(ElasticsearchRepositoriesAutoConfigurationTests.class)
@EnableReactiveElasticsearchRepositories
@EnableElasticsearchAuditing
static class AuditingConfiguration {
}
}

Loading…
Cancel
Save