|
| 1 | +/* |
| 2 | + * Copyright 2021 - 2022 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 | +package org.springframework.sbm.boot.upgrade_27_30.report.helper; |
| 17 | + |
| 18 | +import org.junit.jupiter.api.Test; |
| 19 | +import org.junit.jupiter.api.DisplayName; |
| 20 | +import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportTestSupport; |
| 21 | +import org.springframework.sbm.engine.context.ProjectContext; |
| 22 | +import org.springframework.sbm.project.resource.TestProjectContext; |
| 23 | + |
| 24 | +class ElasticsearchClientsAndTemplatesReportSectionTest { |
| 25 | + @Test |
| 26 | + @DisplayName("Elasticsearch Clients and Templates should render") |
| 27 | + void withSingleModuleApplicationShouldRender() { |
| 28 | + ProjectContext context = TestProjectContext |
| 29 | + .buildProjectContext() |
| 30 | + .withSpringBootParentOf("2.7.5") |
| 31 | + .withBuildFileHavingDependencies("org.springframework.data:spring-data-elasticsearch:4.4.6") |
| 32 | + .build(); |
| 33 | + |
| 34 | + SpringBootUpgradeReportTestSupport.generatedSection("Elasticsearch Clients and Templates") |
| 35 | + .fromProjectContext(context) |
| 36 | + .shouldRenderAs(""" |
| 37 | + === Elasticsearch Clients and Templates |
| 38 | + |
| 39 | + ==== What Changed |
| 40 | + Support for Elasticsearch's high-level REST client has been removed. |
| 41 | + In its place, auto-configuration for Elasticsearch's new Java client has been introduced. |
| 42 | + Similarly, support for the Spring Data Elasticsearch templates that built on top of the high-level REST client has been removed. |
| 43 | + In its place, auto-configuration for the new templates that build upon the new Java client has been introduced. |
| 44 | + See https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#elasticsearch.clients[the Elasticsearch section of the reference documentation] for further details. |
| 45 | + |
| 46 | + `ReactiveElasticsearchRestClientAutoConfiguration` has been renamed to `ReactiveElasticsearchClientAutoConfiguration` and has moved from `org.springframework.boot.autoconfigure.data.elasticsearch` to `org.springframework.boot.autoconfigure.elasticsearch`. |
| 47 | + Any auto-configuration exclusions or ordering should be updated accordingly. |
| 48 | + |
| 49 | + ==== Why is the application affected |
| 50 | + Actually, we don't know if the scanned application is really affected by this change. |
| 51 | + But we found a dependency matching regex `org\\.springframework\\.data\\:spring-data-elasticsearch\\:.*`. |
| 52 | + This indicates that the scanned application might be affected. |
| 53 | + |
| 54 | + ==== Remediation |
| 55 | + [IMPORTANT] |
| 56 | + ==== |
| 57 | + This section has been automatically generated from the https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#elasticsearch-clients-and-templates[Spring Boot 3.0 Migration Guide^, role="ext-link"]. + |
| 58 | + **Please consider contributing to issue https://github.com/spring-projects-experimental/spring-boot-migrator/issues/688[#688^, role="ext-link"]** |
| 59 | + ==== |
| 60 | + |
| 61 | +
|
| 62 | + """); |
| 63 | + } |
| 64 | + |
| 65 | + @Test |
| 66 | + @DisplayName("Elasticsearch Clients and Templates should not render") |
| 67 | + void shouldNotRender() { |
| 68 | + ProjectContext context = TestProjectContext |
| 69 | + .buildProjectContext() |
| 70 | + .build(); |
| 71 | + |
| 72 | + SpringBootUpgradeReportTestSupport.generatedSection("Elasticsearch Clients and Templates") |
| 73 | + .fromProjectContext(context) |
| 74 | + .shouldNotRender(); |
| 75 | + } |
| 76 | +} |
0 commit comments