Skip to content

Commit

Permalink
Add missing artifactIds to fix tests (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek authored Nov 11, 2024
1 parent d692400 commit d099a27
Show file tree
Hide file tree
Showing 4 changed files with 695 additions and 623 deletions.
7 changes: 7 additions & 0 deletions src/test/java/org/openrewrite/jenkins/AddPluginsBomTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void shouldNotAddBomIfNoDependencies() {
<version>4.86</version>
<relativePath/>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
Expand All @@ -68,6 +69,7 @@ void shouldNotAddBomIfNoManagedDependencies() {
<version>4.86</version>
<relativePath/>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
Expand Down Expand Up @@ -102,6 +104,7 @@ void shouldAddBomIfManagedDependencies() {
<version>4.86</version>
<relativePath/>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
Expand Down Expand Up @@ -141,6 +144,7 @@ void shouldLeaveBomVersionIfAlreadyPresent() {
<version>4.86</version>
<relativePath/>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
Expand Down Expand Up @@ -186,6 +190,7 @@ void shouldFixOutdatedPluginsBom() {
<version>4.86</version>
<relativePath/>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
Expand Down Expand Up @@ -267,6 +272,7 @@ void shouldFixOutdatedPluginsBomEvenIfUnused() {
<version>4.86</version>
<relativePath/>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
Expand Down Expand Up @@ -317,6 +323,7 @@ void shouldLeaveOtherBomsAlone() {
<version>4.86</version>
<relativePath/>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.440.3</jenkins.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,69 +31,78 @@ public void defaults(RecipeSpec spec) {
@Test
@DocumentExample
void shouldAddRelativePathIfMissing() {
rewriteRun(pomXml(
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.86</version>
</parent>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""",
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.86</version>
<relativePath/>
</parent>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
rewriteRun(
//language=xml
pomXml(
"""
));
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.86</version>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
""",
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.86</version>
<relativePath/>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
"""
)
);
}

@Test
void shouldNoOpIfRelativePathAlreadyPresent() {
rewriteRun(pomXml(
"""
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.86</version>
<relativePath/>
</parent>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
rewriteRun(
//language=xml
pomXml(
"""
));
<project>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.86</version>
<relativePath/>
</parent>
<artifactId>foo</artifactId>
<properties>
<jenkins.version>2.303.3</jenkins.version>
</properties>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
</project>
"""
)
);
}
}
Loading

0 comments on commit d099a27

Please sign in to comment.