-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#537 add test case for UpgradeSpringBoot_3_3 expecting java, spring and spring cloud version updates #539
Conversation
…a, spring and spring cloud version updates
…Element NoClassDefFoundException
Thanks a lot for reducing the issue you had down to a runnable unit test! Should help in debugging this; I suspect it's something to do with transitive dependencies, seeing how the behavior changes with or without Mockito if I understood #537 correctly. As a quick first step we might see if pull forward, or pushing backwards in recipe order any Mockito upgrade might already provide relief. 🤔 Might take me a bit of time to dive into this one in detail, but let me know if you've learned anything from running this test already. |
Thanks again @timbuethe ; I've tried it out locally as we've just had some changes upstream in openrewrite/rewrite. I had to apply some small formatting fixes to your test, and make it expect two cycles of changes (that one's questionable), but with these the test passes locally. diff --git a/src/testWithSpringBoot_3_3/java/org/openrewrite/java/spring/boot3/SpringCloudVersionUpgradeTest.java b/src/testWithSpringBoot_3_3/java/org/openrewrite/java/spring/boot3/SpringCloudVersionUpgradeTest.java
index aac5066..dcd0f05 100644
--- a/src/testWithSpringBoot_3_3/java/org/openrewrite/java/spring/boot3/SpringCloudVersionUpgradeTest.java
+++ b/src/testWithSpringBoot_3_3/java/org/openrewrite/java/spring/boot3/SpringCloudVersionUpgradeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2023 the original author or authors.
+ * 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.
@@ -26,16 +26,16 @@ 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"));
+ .classpath("jaxb-api"));
}
@Test
@@ -45,82 +45,81 @@ class SpringCloudVersionUpgradeTest implements RewriteTest {
//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>
+ <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>
+ <groupId>com.example</groupId>
+ <artifactId>fooservice</artifactId>
+ <version>1.0-SNAPSHOT</version>
- <name>FooService</name>
+ <name>FooService</name>
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>2.2.2.RELEASE</version>
- <relativePath/>
- </parent>
+ <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>
+ <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>
+ <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>
+ 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>
+ <groupId>com.example</groupId>
+ <artifactId>fooservice</artifactId>
+ <version>1.0-SNAPSHOT</version>
- <name>FooService</name>
+ <name>FooService</name>
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>3.3.0</version>
- <relativePath/>
- </parent>
+ <parent>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-parent</artifactId>
+ <version>3.3.1</version>
+ <relativePath/>
+ </parent>
- <properties>
+ <properties>
<java.version>17</java.version>
<spring-cloud.version>2023.0.2</spring-cloud.version>
<mockito.version>2.18.3</mockito.version>
- </properties>
+ </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>
+ <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>
"""
)
)
);
}
-
} |
I could not push these changes up to |
Hey @timtebeek, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @timbuethe ! Good to have a first explicit 3.3 test to validate the migration works as expected. I'll polish some more on the main branch for simplicity.
What's changed?
What's your motivation?
This should reproduce issue #537
Any additional context