-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#537 add test case for UpgradeSpringBoot_3_3 expecting java, spring a…
…nd spring cloud version updates (#539) * #537 add test case for UpgradeSpringBoot_3_3 expecting java, spring and spring cloud version updates * #537 add jaxb-api to prevent javax.xml.bind.annotation.XmlElement NoClassDefFoundException * #537 apply patch from PR to fix formatting and set expected cycles: 2 #539 (comment)
- Loading branch information
Showing
3 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/testWithSpringBoot_3_3/java/org/openrewrite/java/spring/boot3/.editorconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
root = true | ||
|
||
[*.java] | ||
indent_size = 4 | ||
ij_continuation_indent_size = 2 |
125 changes: 125 additions & 0 deletions
125
...hSpringBoot_3_3/java/org/openrewrite/java/spring/boot3/SpringCloudVersionUpgradeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* <p> | ||
* 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 | ||
* <p> | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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.openrewrite.java.spring.boot3; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.openrewrite.config.Environment; | ||
import org.openrewrite.java.JavaParser; | ||
import org.openrewrite.test.RecipeSpec; | ||
import org.openrewrite.test.RewriteTest; | ||
|
||
import static org.openrewrite.java.Assertions.mavenProject; | ||
import static org.openrewrite.maven.Assertions.pomXml; | ||
|
||
class SpringCloudVersionUpgradeTest implements RewriteTest { | ||
|
||
@Override | ||
public void defaults(RecipeSpec spec) { | ||
spec | ||
.expectedCyclesThatMakeChanges(2) | ||
.recipe(Environment.builder() | ||
.scanRuntimeClasspath("org.openrewrite.java.spring") | ||
.build() | ||
.activateRecipes("org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_3") | ||
).parser(JavaParser.fromJavaVersion() | ||
.classpath("jaxb-api")); | ||
} | ||
|
||
@Test | ||
void upgradeSpringCloudVersion() { | ||
rewriteRun( | ||
mavenProject("project", | ||
//language=xml | ||
pomXml( | ||
""" | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>fooservice</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>FooService</name> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>2.2.2.RELEASE</version> | ||
<relativePath/> | ||
</parent> | ||
<properties> | ||
<java.version>11</java.version> | ||
<spring-cloud.version>Hoxton.SR9</spring-cloud.version> | ||
<mockito.version>2.18.3</mockito.version> | ||
</properties> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-dependencies</artifactId> | ||
<version>${spring-cloud.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> | ||
""", | ||
""" | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example</groupId> | ||
<artifactId>fooservice</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<name>FooService</name> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.3.1</version> | ||
<relativePath/> | ||
</parent> | ||
<properties> | ||
<java.version>17</java.version> | ||
<spring-cloud.version>2023.0.2</spring-cloud.version> | ||
<mockito.version>2.18.3</mockito.version> | ||
</properties> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-dependencies</artifactId> | ||
<version>${spring-cloud.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
</project> | ||
""" | ||
) | ||
) | ||
); | ||
} | ||
} |