Skip to content

Commit 4a8f350

Browse files
committed
Fix Tests and recipe sbu30-upgrade-dependencies
1 parent b6b6422 commit 4a8f350

File tree

7 files changed

+641
-619
lines changed

7 files changed

+641
-619
lines changed

components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/migration/sbu30-upgrade-dependencies.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
newGroupId: com.github.tomakehurst
3131
newArtifactId: wiremock-jre8-standalone
3232
newVersion: 2.34.0
33-
- org.openrewrite.maven.ChangeManagedDependencyGroupIdAndArtifactId:
33+
- org.openrewrite.maven.ChangeDependencyGroupIdAndArtifactId:
3434
oldGroupId: com.github.tomakehurst
3535
oldArtifactId: wiremock-jre8
3636
newGroupId: com.github.tomakehurst

components/sbm-recipes-boot-upgrade/src/main/resources/recipes/27_30/report/sbu30-report.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@
186186
* `${file}`
187187
</#list>
188188
remediation:
189-
description: |-
190-
and replace it with text-banner with banner.txt file
189+
description: ""
191190
possibilities:
192191
- title: Remove image banner
193192
description: |-

components/sbm-recipes-boot-upgrade/src/main/resources/recipes/boot-2.7-3.0-dependency-version-update.yaml

Lines changed: 590 additions & 590 deletions
Large diffs are not rendered by default.

components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/SpringBootUpgradeReportTestSupport.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,14 @@ private void withRecipes(Consumer<Recipes> recipesConsumer) {
247247
}
248248

249249
private String replacePlaceHolders(String expectedOutput, Map<String, String> templateVariables) {
250-
ST st = new ST(expectedOutput);
251-
templateVariables.entrySet().stream().forEach(e -> st.add(e.getKey(), e.getValue()));
252-
return st.render();
250+
StringBuffer sb = new StringBuffer();
251+
// hacked, there's most probably a better way but ST couldn't digest html code
252+
for(Map.Entry<String, String> kv : templateVariables.entrySet()) {
253+
String key = "<" + kv.getKey() + ">";
254+
String replacement = kv.getValue();
255+
expectedOutput = expectedOutput.replace(key, replacement);
256+
}
257+
return expectedOutput;
253258
}
254259
}
255260

components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/BannerSupportReportSectionTest.java

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,43 @@ public void rendersBannerSupportInformation() {
3737
.fromProjectContext(context)
3838
.shouldRenderAs(
3939
"""
40-
=== Banner support
41-
Issue: https://github.com/spring-projects-experimental/spring-boot-migrator/issues/150[#150], Contributors: https://github.com/sanagaraj-pivotal[@sanagaraj-pivotal^, role="ext-link"]
42-
43-
==== What Changed
44-
Support for image-based application banners has been removed. banner.gif, banner.jpg, and banner.png
45-
files are now ignored and should be replaced with a text-based banner.txt file.
46-
47-
==== Why is the application affected
48-
The scan found banner image files here:
49-
50-
* <PATH>/src/main/resources/banner.gif
51-
* <PATH>/src/main/resources/banner.jpg
52-
53-
==== Remediation
54-
remove image banners and replace it with text-banner with banner.txt file
55-
56-
57-
""");
40+
=== Banner support
41+
Issue: https://github.com/spring-projects-experimental/spring-boot-migrator/issues/150[#150], Contributors: https://github.com/fabapp2[@fabapp2^, role="ext-link"], https://github.com/sanagaraj-pivotal[@sanagaraj-pivotal^, role="ext-link"]
42+
43+
==== What Changed
44+
Support for image-based application banners has been removed. banner.gif, banner.jpg, and banner.png
45+
files are now ignored and should be replaced with a text-based banner.txt file.
46+
47+
==== Why is the application affected
48+
The scan found banner image files here:
49+
50+
* `<PATH>/src/main/resources/banner.gif`
51+
* `<PATH>/src/main/resources/banner.jpg`
52+
53+
==== Remediation
54+
55+
56+
===== Remove image banner
57+
Remove these image banners\s
58+
59+
* `/Users/fkrueger/projects/spring-boot-migrator/components/sbm-recipes-boot-upgrade/target/dummy-test-path/src/main/resources/banner.gif`
60+
* `/Users/fkrueger/projects/spring-boot-migrator/components/sbm-recipes-boot-upgrade/target/dummy-test-path/src/main/resources/banner.jpg`
61+
62+
63+
64+
++++
65+
<div class="run-a-recipe" recipe="sbu30-remove-image-banner">
66+
</div>
67+
++++
68+
===== Replace image banner
69+
Replace these banners\s
70+
71+
* `/Users/fkrueger/projects/spring-boot-migrator/components/sbm-recipes-boot-upgrade/target/dummy-test-path/src/main/resources/banner.gif`
72+
* `/Users/fkrueger/projects/spring-boot-migrator/components/sbm-recipes-boot-upgrade/target/dummy-test-path/src/main/resources/banner.jpg`
73+
74+
with `banner.txt`
75+
76+
77+
""");
5878
}
5979
}

components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/SpringMVCAndWebFluxUrlMatchingChangesReportSectionTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public void configurePathMatch(PathMatchConfigurer configurer) {
105105
106106
==== Why is the application affected
107107
The scan found classes annotated with `@RestController` which could be affected by this change.
108-
* file://<PATH>/src/main/java/a/example/RestController2.java[`src/main/java/a/example/RestController2.java`]<#lt>
109-
* file://<PATH>/src/main/java/b/example/RestController1.java[`src/main/java/b/example/RestController1.java`]<#lt>
108+
* file://<PATH>/src/main/java/a/example/RestController2.java[`src/main/java/a/example/RestController2.java`]
109+
* file://<PATH>/src/main/java/b/example/RestController1.java[`src/main/java/b/example/RestController1.java`]
110110
111111
==== Remediation
112112
You have different choices to remediate this change.
@@ -152,8 +152,6 @@ public void configurePathMatch(PathMatchConfigurer configurer) {
152152
}
153153
....
154154
155-
sbu30-248-add-PathMatchConfigurer
156-
157155
158156
""";
159157

components/sbm-recipes-boot-upgrade/src/test/java/org/springframework/sbm/boot/upgrade_27_30/report/helper/UpgradeDepenenciesMigrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636
public class UpgradeDepenenciesMigrationTest {
3737
@Test
38-
void test_renameMe() {
38+
void migrateEhCacheToSpringBoot3() {
3939
ProjectContext context = TestProjectContext.buildProjectContext()
4040
.withSpringBootParentOf("2.7.5")
4141
.withBuildFileHavingDependencies("org.ehcache:ehcache")

0 commit comments

Comments
 (0)