Skip to content

Commit

Permalink
Relocate ModernizeJenkinsPlugin
Browse files Browse the repository at this point in the history
Rewrite test in java. Issue #4
  • Loading branch information
sghill committed Jun 29, 2023
1 parent 706aace commit 9c1ef31
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/rewrite/rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ recipeList:
artifactId: commons-lang3
---
type: specs.openrewrite.org/v1beta/recipe
name: net.sghill.jenkins.ModernizePlugin
name: org.openrewrite.jenkins.ModernizePlugin
recipeList:
- org.openrewrite.jenkins.ChangeJenkinsVersion:
parentPomVersion: "4.64"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.sghill.jenkins.rewrite
package org.openrewrite.jenkins;

import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import org.openrewrite.maven.Assertions.pomXml
import org.openrewrite.test.RecipeSpec
import org.openrewrite.test.RewriteTest
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;

class ModernizeJenkinsPluginTest : RewriteTest {
import static org.openrewrite.maven.Assertions.pomXml;

override fun defaults(spec: RecipeSpec) {
spec.recipeFromResource("/META-INF/rewrite/rewrite.yml", "net.sghill.jenkins.ModernizePlugin")
class ModernizeJenkinsPluginTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.recipeFromResource("/META-INF/rewrite/rewrite.yml", "org.openrewrite.jenkins.ModernizePlugin");
}

@Test
fun majorVersionUpgrade() = rewriteRun(
pomXml(
"""
void shouldUpgradeMajorVersion() {
rewriteRun(pomXml(
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -50,7 +51,8 @@ fun majorVersionUpgrade() = rewriteRun(
</repository>
</repositories>
</project>
""", """
""".stripIndent(),
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -70,15 +72,15 @@ fun majorVersionUpgrade() = rewriteRun(
</repository>
</repositories>
</project>
"""
)
)
""".stripIndent()
));
}

@Test
@Disabled
fun pluginInBom() = rewriteRun(
pomXml(
"""
void shouldHandlePluginInBom() {
rewriteRun(pomXml(
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -105,7 +107,8 @@ fun pluginInBom() = rewriteRun(
</repository>
</repositories>
</project>
""","""
""".stripIndent(),
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down Expand Up @@ -142,7 +145,7 @@ fun pluginInBom() = rewriteRun(
</repository>
</repositories>
</project>
""",
)
)
}
""".stripIndent()
));
}
}

0 comments on commit 9c1ef31

Please sign in to comment.