From cf432aab78d6bfe8001da92066a29b6c08bee281 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 21 Dec 2023 15:48:36 +0100 Subject: [PATCH 1/3] build(deps): bump me.tongfei:progressbar from 0.9.5 to 0.10.0 (#1024) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [me.tongfei:progressbar](https://github.com/ctongfei/progressbar) from 0.9.5 to 0.10.0.
Release notes

Sourced from me.tongfei:progressbar's releases.

0.10.0

Changelog

Sourced from me.tongfei:progressbar's changelog.

Changelog

... (truncated)

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=me.tongfei:progressbar&package-manager=maven&previous-version=0.9.5&new-version=0.10.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c66dca5fc..5913c0a3c 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 4.32.0 1.17.0 2.7.5 - 0.9.5 + 0.10.0 1.19.1 3.2.0 3.1.4 From b575cb6068c011d2e2dcb1a1877a0ef5c1d24074 Mon Sep 17 00:00:00 2001 From: Vincent Botteman Date: Thu, 21 Dec 2023 15:49:58 +0100 Subject: [PATCH 2/3] Fix test ConvertJaxRsAnnotationsTest.convertJaxRsMethodWithoutPathToSpringMvc (#1021) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix test convertJaxRsMethodWithoutPathToSpringMvc (issue #897) and improve the test code Co-authored-by: Fabian Krüger <56278322+fabapp2@users.noreply.github.com> --- .../actions/ConvertJaxRsAnnotationsTest.java | 435 ++++++++---------- 1 file changed, 189 insertions(+), 246 deletions(-) diff --git a/components/sbm-recipes-jee-to-boot/src/test/java/org/springframework/sbm/jee/jaxrs/actions/ConvertJaxRsAnnotationsTest.java b/components/sbm-recipes-jee-to-boot/src/test/java/org/springframework/sbm/jee/jaxrs/actions/ConvertJaxRsAnnotationsTest.java index 308b5e39e..4019c7244 100644 --- a/components/sbm-recipes-jee-to-boot/src/test/java/org/springframework/sbm/jee/jaxrs/actions/ConvertJaxRsAnnotationsTest.java +++ b/components/sbm-recipes-jee-to-boot/src/test/java/org/springframework/sbm/jee/jaxrs/actions/ConvertJaxRsAnnotationsTest.java @@ -16,24 +16,16 @@ package org.springframework.sbm.jee.jaxrs.actions; import org.intellij.lang.annotations.Language; -import org.junit.jupiter.api.Disabled; -import org.junitpioneer.jupiter.ExpectedToFail; -import org.springframework.sbm.java.api.JavaSource; +import org.junit.jupiter.api.Test; import org.springframework.sbm.engine.context.ProjectContext; -import org.springframework.sbm.java.api.Method; -import org.springframework.sbm.java.migration.conditions.HasTypeAnnotation; +import org.springframework.sbm.java.api.JavaSource; import org.springframework.sbm.project.resource.TestProjectContext; -import org.junit.jupiter.api.Test; -import org.springframework.sbm.testhelper.common.utils.TestDiff; import static org.assertj.core.api.Assertions.assertThat; -public class ConvertJaxRsAnnotationsTest { - - private final static String SPRING_VERSION = "5.3.13"; +class ConvertJaxRsAnnotationsTest { @Test - @Disabled("https://github.com/spring-projects-experimental/spring-boot-migrator/issues/897") void convertJaxRsMethodWithoutPathToSpringMvc() { @Language("java") String restControllerCode = """ @@ -64,134 +56,87 @@ public List getMovies(@QueryParam("first") Integer first, @QueryParam("ma } """; - ProjectContext context = TestProjectContext - .buildProjectContext() - .withJavaSources(restControllerCode) - .withBuildFileHavingDependencies("org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:1.0.1.Final", - "org.springframework:spring-core:" + SPRING_VERSION) - .build(); - - Method jaxRsMethod = context.getProjectJavaSources() - .list() - .get(0) - .getTypes() - .get(0) - .getMethods() - .get(0); - - ConvertJaxRsAnnotations convertJaxRsAnnotations = ConvertJaxRsAnnotations - .builder() - .condition(HasTypeAnnotation.builder().annotation("javax.ws.rs.Path").build()) - .description("Convert JAX-RS annotations into Spring Boot annotations.") - .build(); - - convertJaxRsAnnotations.convertJaxRsMethodToSpringMvc(jaxRsMethod); - - @Language("java") - String expected = - """ + String expected = """ package com.example.jeerest.rest; - + import com.example.jeerest.Movie; import com.example.jeerest.MoviesBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; - + import org.springframework.web.bind.annotation.RestController; + import javax.ws.rs.DELETE; import javax.ws.rs.PUT; - import javax.ws.rs.Path; import javax.ws.rs.PathParam; - import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import java.util.List; - - @Path("movies") - @Produces({"application/json"}) + + + @RestController + @RequestMapping(value = "movies", produces = {"application/json"}) public class MoviesRest { - @RequestMapping(method = RequestMethod.GET) - public List getMovies(@QueryParam("first") Integer first, @QueryParam("max") Integer max, - @QueryParam("field") String field, @QueryParam("searchTerm") String searchTerm) { - return service.getMovies(first, max, field, searchTerm); - } + @RequestMapping(method = RequestMethod.GET) + public List getMovies(@QueryParam("first") Integer first, @QueryParam("max") Integer max, + @QueryParam("field") String field, @QueryParam("searchTerm") String searchTerm) { + return service.getMovies(first, max, field, searchTerm); + } } """; -// """ -// package com.example.jeerest.rest; -// -// import com.example.jeerest.Movie; -// import com.example.jeerest.MoviesBean; -// import org.springframework.beans.factory.annotation.Autowired; -// -// import javax.ws.rs.DELETE; -// import javax.ws.rs.PUT; -// import javax.ws.rs.Path; -// import javax.ws.rs.PathParam; -// import javax.ws.rs.Produces; -// import javax.ws.rs.QueryParam; -// import javax.ws.rs.core.MediaType; -// import java.util.List; -// -// @Path("movies") -// @Produces({"application/json"}) -// public class MoviesRest { -// @RequestMapping(method = RequestMethod.GET) -// public List getMovies(@QueryParam("first") Integer first, @QueryParam("max") Integer max, -// @QueryParam("field") String field, @QueryParam("searchTerm") String searchTerm) { -// return service.getMovies(first, max, field, searchTerm); -// } -// } -// """; - - String given = context.getProjectJavaSources().list().get(0).print(); - assertThat(given).as(() -> TestDiff.of(given, expected)).isEqualTo(expected); + + + ProjectContext projectContext = TestProjectContext.buildProjectContext() + .withJavaSources(restControllerCode) + .withBuildFileHavingDependencies("org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_2.1_spec:1.0.1.Final", "org.springframework.boot:spring-boot-starter-web:2.4.2") + .build(); + ConvertJaxRsAnnotations sut = new ConvertJaxRsAnnotations(); + sut.apply(projectContext); + + assertThat(projectContext.getProjectJavaSources().list().get(0).print()).isEqualTo(expected); } @Test - void replaceMethodAnnotationsWithOneAnnotation() throws Exception { - - String sourceCode = "" + - "import javax.ws.rs.Path;\n" + - "import javax.ws.rs.Consumes;\n" + - "import javax.ws.rs.POST;\n" + - "import javax.ws.rs.Path;\n" + - "import javax.ws.rs.PathParam;\n" + - "import javax.ws.rs.Produces;\n" + - "import javax.ws.rs.core.MediaType;\n" + - "\n" + - "\n" + - "@Path(\"/hello\")\n" + - "class ControllerClass {\n" + - " @POST\n" + - " @Path(\"/json/{name}\")\n" + - " @Produces({\"image/jpeg\", \"image/gif\", \"image/png\", MediaType.APPLICATION_XML})\n" + - " @Consumes(\"application/json\")\n" + - " public String getHelloWorldJSON(" + - " @PathParam(\"name\") " + - " String name) {\n" + - " return \"Hello\";\n" + - " }\n" + - "}"; - - String expected = "import org.springframework.web.bind.annotation.RequestMapping;\n" + - "import org.springframework.web.bind.annotation.RequestMethod;\n" + - "import org.springframework.web.bind.annotation.RestController;\n" + - "import javax.ws.rs.PathParam;\n" + - "import javax.ws.rs.core.MediaType;\n" + - "\n" + - "\n" + - "@RestController\n" + - "@RequestMapping(value = \"/hello\")\n" + - "class ControllerClass {\n" + - " @RequestMapping(value = \"/json/{name}\", produces = {\"image/jpeg\", \"image/gif\", \"image/png\", MediaType.APPLICATION_XML}, consumes = \"application/json\", method = RequestMethod.POST)\n" + - " public String getHelloWorldJSON(" + - " @PathParam(\"name\") " + - " String name) {\n" + - " return \"Hello\";\n" + - " }\n" + - "}"; + void replaceMethodAnnotationsWithOneAnnotation() { + + String sourceCode = """ + import javax.ws.rs.Path; + import javax.ws.rs.Consumes; + import javax.ws.rs.POST; + import javax.ws.rs.Path; + import javax.ws.rs.PathParam; + import javax.ws.rs.Produces; + import javax.ws.rs.core.MediaType; + + + @Path("/hello") + class ControllerClass { + @POST + @Path("/json/{name}") + @Produces({"image/jpeg", "image/gif", "image/png", MediaType.APPLICATION_XML}) + @Consumes("application/json") + public String getHelloWorldJSON( @PathParam("name") String name) { + return "Hello"; + } + }"""; + + String expected = """ + import org.springframework.web.bind.annotation.RequestMapping; + import org.springframework.web.bind.annotation.RequestMethod; + import org.springframework.web.bind.annotation.RestController; + import javax.ws.rs.PathParam; + import javax.ws.rs.core.MediaType; + + + @RestController + @RequestMapping(value = "/hello") + class ControllerClass { + @RequestMapping(value = "/json/{name}", produces = {"image/jpeg", "image/gif", "image/png", MediaType.APPLICATION_XML}, consumes = "application/json", method = RequestMethod.POST) + public String getHelloWorldJSON( @PathParam("name") String name) { + return "Hello"; + } + }"""; ProjectContext projectContext = TestProjectContext.buildProjectContext() .withJavaSources(sourceCode) @@ -208,37 +153,36 @@ void replaceMethodAnnotationsWithOneAnnotation() throws Exception { @Test - void replaceMethodAnnotations() throws Exception { - String sourceCode = - "import javax.ws.rs.Path;\n" + - "import javax.ws.rs.Consumes;\n" + - "import javax.ws.rs.*;\n" + - "import javax.ws.rs.Path;\n" + - "import javax.ws.rs.PathParam;\n" + - "import javax.ws.rs.Produces;\n" + - "import javax.ws.rs.core.MediaType;\n" + - " \n" + - " \n" + - "@Path(\"/hello\") \n" + - "class ControllerClass { \n" + - " @POST\n" + - " @GET\n" + - " @PUT\n" + - " @DELETE\n" + - " @Path(\"/json/{name}\")\n" + - " @Produces({\"image/jpeg\", \"image/gif\", \"image/png\", MediaType.APPLICATION_XML})\n" + - " @Consumes(\"application/json\")\n" + - " public String getHelloWorldJSON(@PathParam(\"name\") String name) {\n" + - " return \"Hello\";\n" + - " }\n" + - " public String notAnEndpoint(@PathParam(\"name\") String name) {\n" + - " return \"Hello\";\n" + - " }\n" + - "}"; + void replaceMethodAnnotations() { + String sourceCode = """ + import javax.ws.rs.Path; + import javax.ws.rs.Consumes; + import javax.ws.rs.*; + import javax.ws.rs.Path; + import javax.ws.rs.PathParam; + import javax.ws.rs.Produces; + import javax.ws.rs.core.MediaType; + + + @Path("/hello") + class ControllerClass { + @POST + @GET + @PUT + @DELETE + @Path("/json/{name}") + @Produces({"image/jpeg", "image/gif", "image/png", MediaType.APPLICATION_XML}) + @Consumes("application/json") + public String getHelloWorldJSON(@PathParam("name") String name) { + return "Hello"; + } + public String notAnEndpoint(@PathParam("name") String name) { + return "Hello"; + } + }"""; @Language("java") - String expected = - """ + String expected = """ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @@ -273,72 +217,71 @@ public String notAnEndpoint(@PathParam("name") String name) { @Test void migrateToController() { - String sourceCode = - "package com.example.jee.app;\n" + - "\n" + - "import javax.inject.Inject;\n" + - "import javax.ws.rs.*;\n" + - "import javax.ws.rs.core.MediaType;\n" + - "import java.util.stream.Collectors;\n" + - - "\n" + - "@Path(\"/\")\n" + - "public class PersonController {\n" + - "\n" + - " @POST\n" + - " @Path(\"/json/{name}\")\n" + - " @Produces(\"application/json\")\n" + - " @Consumes(\"application/json\")\n" + - " public String getHelloWorldJSON(@PathParam(\"name\") String name) throws Exception {\n" + - " return \"\";\n" + - " }\n" + - "\n" + - " @GET\n" + - " @Path(\"/json\")\n" + - " @Produces(MediaType.APPLICATION_JSON)\n" + - " @Consumes(MediaType.APPLICATION_JSON)\n" + - " public String getAllPersons() throws Exception {\n" + - " return \"\";\n" + - " }\n" + - "\n" + - " @POST\n" + - " @Path(\"/xml/{name}\")\n" + - " @Produces(MediaType.APPLICATION_XML)\n" + - " @Consumes(MediaType.APPLICATION_XML)\n" + - " public String getHelloWorldXML(@PathParam(\"name\") String name) throws Exception {\n" + - " return \"\";\n" + - " }\n" + - "}"; - - String expected = - "package com.example.jee.app;\n" + - "\n" + - "import org.springframework.web.bind.annotation.RequestMapping;\n" + - "import org.springframework.web.bind.annotation.RequestMethod;\n" + - "import org.springframework.web.bind.annotation.RestController;\n" + - "\n" + - "import javax.ws.rs.PathParam;\n" + - "import javax.ws.rs.core.MediaType;\n" + - "\n" + - "@RestController\n" + - "@RequestMapping(value = \"/\")\n" + - "public class PersonController {\n" + - "\n" + - " @RequestMapping(value = \"/json/{name}\", produces = \"application/json\", consumes = \"application/json\", method = RequestMethod.POST)\n" + - " public String getHelloWorldJSON(@PathParam(\"name\") String name) throws Exception {\n" + - " return \"\";\n" + - " }\n" + - "\n" + - " @RequestMapping(value = \"/json\", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, method = RequestMethod.GET)\n" + - " public String getAllPersons() throws Exception {\n" + - " return \"\";\n" + - " }\n" + - "\n" + - " @RequestMapping(value = \"/xml/{name}\", produces = MediaType.APPLICATION_XML, consumes = MediaType.APPLICATION_XML, method = RequestMethod.POST)\n" + - " public String getHelloWorldXML(@PathParam(\"name\") String name) throws Exception {\n" + - " return \"\";\n" + - " }\n" + - "}"; + String sourceCode = """ + package com.example.jee.app; + + import javax.inject.Inject; + 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 { + return ""; + } + + @GET + @Path("/json") + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public String getAllPersons() throws Exception { + return ""; + } + + @POST + @Path("/xml/{name}") + @Produces(MediaType.APPLICATION_XML) + @Consumes(MediaType.APPLICATION_XML) + public String getHelloWorldXML(@PathParam("name") String name) throws Exception { + return ""; + } + }"""; + + String expected = """ + package com.example.jee.app; + + import org.springframework.web.bind.annotation.RequestMapping; + import org.springframework.web.bind.annotation.RequestMethod; + import org.springframework.web.bind.annotation.RestController; + + import javax.ws.rs.PathParam; + import javax.ws.rs.core.MediaType; + + @RestController + @RequestMapping(value = "/") + public class PersonController { + + @RequestMapping(value = "/json/{name}", produces = "application/json", consumes = "application/json", method = RequestMethod.POST) + public String getHelloWorldJSON(@PathParam("name") String name) throws Exception { + return ""; + } + + @RequestMapping(value = "/json", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, method = RequestMethod.GET) + public String getAllPersons() throws Exception { + return ""; + } + + @RequestMapping(value = "/xml/{name}", produces = MediaType.APPLICATION_XML, consumes = MediaType.APPLICATION_XML, method = RequestMethod.POST) + public String getHelloWorldXML(@PathParam("name") String name) throws Exception { + return ""; + } + }"""; ProjectContext projectContext = TestProjectContext.buildProjectContext() .withJavaSources(sourceCode) @@ -353,37 +296,37 @@ void migrateToController() { } @Test - void addRequestBodyOverParameter() throws Exception { - String sourceCode = - "import javax.ws.rs.Path;\n" + - "import javax.ws.rs.POST;\n" + - "import javax.ws.rs.Path;\n" + - "import javax.ws.rs.PathParam;\n" + - "\n" + - "@Path(\"/hello\")\n" + - "class ControllerClass {\n" + - " @POST\n" + - " @Path(\"/json/{name}\")\n" + - " public String create(@PathParam(\"name\") String name, String data) {\n" + - " return \"Hello\";\n" + - " }\n" + - "}"; - - String expected = - "import org.springframework.web.bind.annotation.RequestBody;\n" + - "import org.springframework.web.bind.annotation.RequestMapping;\n" + - "import org.springframework.web.bind.annotation.RequestMethod;\n" + - "import org.springframework.web.bind.annotation.RestController;\n" + - "import javax.ws.rs.PathParam;\n" + - "\n" + - "@RestController\n" + - "@RequestMapping(value = \"/hello\")\n" + - "class ControllerClass {\n" + - " @RequestMapping(value = \"/json/{name}\", method = RequestMethod.POST)\n" + - " public String create(@PathParam(\"name\") String name, @RequestBody String data) {\n" + - " return \"Hello\";\n" + - " }\n" + - "}"; + void addRequestBodyOverParameter() { + String sourceCode = """ + import javax.ws.rs.Path; + import javax.ws.rs.POST; + import javax.ws.rs.Path; + import javax.ws.rs.PathParam; + + @Path("/hello") + class ControllerClass { + @POST + @Path("/json/{name}") + public String create(@PathParam("name") String name, String data) { + return "Hello"; + } + }"""; + + String expected = """ + import org.springframework.web.bind.annotation.RequestBody; + import org.springframework.web.bind.annotation.RequestMapping; + import org.springframework.web.bind.annotation.RequestMethod; + import org.springframework.web.bind.annotation.RestController; + import javax.ws.rs.PathParam; + + @RestController + @RequestMapping(value = "/hello") + class ControllerClass { + @RequestMapping(value = "/json/{name}", method = RequestMethod.POST) + public String create(@PathParam("name") String name, @RequestBody String data) { + return "Hello"; + } + }"""; ProjectContext projectContext = TestProjectContext.buildProjectContext() From c96893fc770fb01d695f67a221235d0a866e72d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Kr=C3=BCger?= <56278322+fabapp2@users.noreply.github.com> Date: Thu, 21 Dec 2023 15:06:23 +0000 Subject: [PATCH 3/3] Reset release 0152 (#1025) --- pom.xml | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/pom.xml b/pom.xml index 5913c0a3c..aadabe6ab 100644 --- a/pom.xml +++ b/pom.xml @@ -345,30 +345,6 @@ - - de.jutzig - github-release-plugin - 1.4.0 - - Description of your release - 0.11.0 - - 0.11.0 - - - - - applications/spring-shell/target - - spring-boot-migrator.jar - - - - spring-projects-experimental/spring-boot-migrator - - org.apache.maven.plugins maven-compiler-plugin