diff --git a/src/test/java/org/openrewrite/jenkins/AddPluginsBomTest.java b/src/test/java/org/openrewrite/jenkins/AddPluginsBomTest.java
index 7a71c61..8b3f9d4 100644
--- a/src/test/java/org/openrewrite/jenkins/AddPluginsBomTest.java
+++ b/src/test/java/org/openrewrite/jenkins/AddPluginsBomTest.java
@@ -42,6 +42,7 @@ void shouldNotAddBomIfNoDependencies() {
4.86
+ foo
2.440.3
@@ -68,6 +69,7 @@ void shouldNotAddBomIfNoManagedDependencies() {
4.86
+ foo
2.440.3
@@ -102,6 +104,7 @@ void shouldAddBomIfManagedDependencies() {
4.86
+ foo
2.440.3
@@ -141,6 +144,7 @@ void shouldLeaveBomVersionIfAlreadyPresent() {
4.86
+ foo
2.440.3
@@ -186,6 +190,7 @@ void shouldFixOutdatedPluginsBom() {
4.86
+ foo
2.440.3
@@ -267,6 +272,7 @@ void shouldFixOutdatedPluginsBomEvenIfUnused() {
4.86
+ foo
2.440.3
@@ -317,6 +323,7 @@ void shouldLeaveOtherBomsAlone() {
4.86
+ foo
2.440.3
diff --git a/src/test/java/org/openrewrite/jenkins/DisableLocalResolutionForParentPomTest.java b/src/test/java/org/openrewrite/jenkins/DisableLocalResolutionForParentPomTest.java
index e3571ab..80a7174 100644
--- a/src/test/java/org/openrewrite/jenkins/DisableLocalResolutionForParentPomTest.java
+++ b/src/test/java/org/openrewrite/jenkins/DisableLocalResolutionForParentPomTest.java
@@ -31,69 +31,78 @@ public void defaults(RecipeSpec spec) {
@Test
@DocumentExample
void shouldAddRelativePathIfMissing() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.86
-
-
- 2.303.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.86
-
-
-
- 2.303.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.86
+
+ foo
+
+ 2.303.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """,
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.86
+
+
+ foo
+
+ 2.303.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
void shouldNoOpIfRelativePathAlreadyPresent() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.86
-
-
-
- 2.303.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.86
+
+
+ foo
+
+ 2.303.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/ModernizePluginForJava8Test.java b/src/test/java/org/openrewrite/jenkins/ModernizePluginForJava8Test.java
index 6d42f86..c355372 100644
--- a/src/test/java/org/openrewrite/jenkins/ModernizePluginForJava8Test.java
+++ b/src/test/java/org/openrewrite/jenkins/ModernizePluginForJava8Test.java
@@ -30,421 +30,462 @@ public void defaults(RecipeSpec spec) {
@Test
void shouldUseHttpsForRepositories() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+ """,
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
void shouldUpgradeParentTo4_51() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.40
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.40
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """,
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
void shouldNotDowngradeParent() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.52
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.52
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
void shouldUpgradeJenkinsTo2_346_3() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.277.1
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 2.277.1
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """,
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
void shouldNotDowngradeJenkins() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
void shouldRemoveJavaLevelProperty() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 8
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 8
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """,
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
void shouldDisableLocalResolutionForParentPom() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """,
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
void shouldRemoveVersionsOnlyIfPresentInJenkinsBom() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
-
- junit
- junit
- 4.4
- test
-
-
- org.jenkins-ci
- annotation-indexer
- 1.16
-
-
- com.lmax
- disruptor
- 3.3.11
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
-
- 2.346.3
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
-
- junit
- junit
- test
-
-
- org.jenkins-ci
- annotation-indexer
-
-
- com.lmax
- disruptor
- 3.3.11
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+ junit
+ junit
+ 4.4
+ test
+
+
+ org.jenkins-ci
+ annotation-indexer
+ 1.16
+
+
+ com.lmax
+ disruptor
+ 3.3.11
+
+
+
+ """,
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ foo
+
+ 2.346.3
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+
+ junit
+ junit
+ test
+
+
+ org.jenkins-ci
+ annotation-indexer
+
+
+ com.lmax
+ disruptor
+ 3.3.11
+
+
+
+ """
+ )
+ );
}
@Test
@DocumentExample
void shouldDoTheWorks() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.42
-
- example-plugin
- 0.8-SNAPSHOT
-
- 2.303.3
- 8
-
-
-
- org.jenkins-ci.plugins
- junit
- 1.12
-
-
-
-
- repo.jenkins-ci.org
- http://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.51
-
-
- example-plugin
- 0.8-SNAPSHOT
-
- 2.346.3
-
-
-
-
- io.jenkins.tools.bom
- bom-2.346.x
- 1763.v092b_8980a_f5e
- pom
- import
-
-
-
-
-
- org.jenkins-ci.plugins
- junit
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.42
+
+ example-plugin
+ 0.8-SNAPSHOT
+
+ 2.303.3
+ 8
+
+
+
+ org.jenkins-ci.plugins
+ junit
+ 1.12
+
+
+
+
+ repo.jenkins-ci.org
+ http://repo.jenkins-ci.org/public/
+
+
+
+ """,
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.51
+
+
+ example-plugin
+ 0.8-SNAPSHOT
+
+ 2.346.3
+
+
+
+
+ io.jenkins.tools.bom
+ bom-2.346.x
+ 1763.v092b_8980a_f5e
+ pom
+ import
+
+
+
+
+
+ org.jenkins-ci.plugins
+ junit
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
}
diff --git a/src/test/java/org/openrewrite/jenkins/ReplaceLibrariesWithApiPluginTest.java b/src/test/java/org/openrewrite/jenkins/ReplaceLibrariesWithApiPluginTest.java
index 600ff04..a60006b 100644
--- a/src/test/java/org/openrewrite/jenkins/ReplaceLibrariesWithApiPluginTest.java
+++ b/src/test/java/org/openrewrite/jenkins/ReplaceLibrariesWithApiPluginTest.java
@@ -38,208 +38,223 @@ public void defaults(RecipeSpec spec) {
@Test
void shouldWorkFromYamlDefinition() {
rewriteRun(spec -> spec.recipeFromResource(
- "/replace-libraries-with-api-plugin.yml",
- "org.openrewrite.jenkins.CommonsTextToApiPlugin"
- ), pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.86
-
-
-
-
- 2.440.3
-
-
-
-
- org.apache.commons
- commons-text
- 1.9
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.86
-
-
-
-
- 2.440.3
-
-
-
-
- io.jenkins.plugins
- commons-text-api
- 1.9-5.v7ea_44fe6061c
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ "/replace-libraries-with-api-plugin.yml",
+ "org.openrewrite.jenkins.CommonsTextToApiPlugin"
+ ),
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.86
+
+
+ foo
+
+
+ 2.440.3
+
+
+
+
+ org.apache.commons
+ commons-text
+ 1.9
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """,
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.86
+
+
+ foo
+
+
+ 2.440.3
+
+
+
+
+ io.jenkins.plugins
+ commons-text-api
+ 1.9-5.v7ea_44fe6061c
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
void shouldReplaceDirectDependencyWithApiPlugin() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.86
-
-
-
-
- 2.440.3
-
-
-
-
- org.apache.commons
- commons-text
- 1.9
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.86
-
-
-
-
- 2.440.3
-
-
-
-
- io.jenkins.plugins
- commons-text-api
- 1.9-5.v7ea_44fe6061c
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.86
+
+
+ foo
+
+
+ 2.440.3
+
+
+
+
+ org.apache.commons
+ commons-text
+ 1.9
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """,
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.86
+
+
+ foo
+
+
+ 2.440.3
+
+
+
+
+ io.jenkins.plugins
+ commons-text-api
+ 1.9-5.v7ea_44fe6061c
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
@Test
@DocumentExample
void shouldExcludeTransitivesFromBundledLibrary() {
- rewriteRun(pomXml(
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.86
-
-
-
-
- 2.440.3
-
-
-
-
- org.apache.turbine
- turbine
- 5.1
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
- """,
- """
-
-
- org.jenkins-ci.plugins
- plugin
- 4.86
-
-
-
-
- 2.440.3
-
-
-
-
- io.jenkins.plugins
- commons-text-api
- 1.9-5.v7ea_44fe6061c
-
-
- org.apache.turbine
- turbine
- 5.1
-
-
-
- org.apache.commons
- commons-text
-
-
-
-
-
-
-
- repo.jenkins-ci.org
- https://repo.jenkins-ci.org/public/
-
-
-
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
- ));
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.86
+
+
+ foo
+
+
+ 2.440.3
+
+
+
+
+ org.apache.turbine
+ turbine
+ 5.1
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """,
+ """
+
+
+ org.jenkins-ci.plugins
+ plugin
+ 4.86
+
+
+ foo
+
+
+ 2.440.3
+
+
+
+
+ io.jenkins.plugins
+ commons-text-api
+ 1.9-5.v7ea_44fe6061c
+
+
+ org.apache.turbine
+ turbine
+ 5.1
+
+
+
+ org.apache.commons
+ commons-text
+
+
+
+
+
+
+
+ repo.jenkins-ci.org
+ https://repo.jenkins-ci.org/public/
+
+
+
+ """
+ )
+ );
}
}