Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reformat test
Browse files Browse the repository at this point in the history
timtebeek committed Jul 17, 2024

Unverified

This user has not yet uploaded their public signing key.
1 parent 5034df0 commit 18b434c
Showing 2 changed files with 120 additions and 120 deletions.
Original file line number Diff line number Diff line change
@@ -278,7 +278,7 @@ private String getProperty(@Nullable String property) {
if (property == null) {
return null;
}
final String propVal = properties.get(property);
String propVal = properties.get(property);
if (propVal != null) {
return propVal;
}
238 changes: 119 additions & 119 deletions rewrite-maven/src/test/java/org/openrewrite/maven/MavenParserTest.java
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ void rangeVersion() {
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -79,7 +79,7 @@ void skipDependencyResolution() {
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>foo</groupId>
@@ -128,7 +128,7 @@ void invalidRange() {
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -517,7 +517,7 @@ void parse() {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
@@ -527,7 +527,7 @@ void parse() {
<name>Trygve Laugst&oslash;l</name>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
@@ -583,19 +583,19 @@ void handlesRepositories() {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openrewrite.maven</groupId>
<artifactId>single-project</artifactId>
<version>0.1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>29.0-jre</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jcenter</id>
@@ -617,15 +617,15 @@ void handlesPropertiesInDependencyScope() {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openrewrite.maven</groupId>
<artifactId>single-project</artifactId>
<version>0.1.0-SNAPSHOT</version>
<properties>
<dependency.scope>compile</dependency.scope>
</properties>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
@@ -677,11 +677,11 @@ void selfRecursiveParent() {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<parent>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
@@ -701,11 +701,11 @@ void selfRecursiveDependency() {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>com.mycompany.app</groupId>
@@ -893,11 +893,11 @@ public MockResponse dispatch(RecordedRequest request) {
resp.setBody("""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>bar</artifactId>
<version>1.0.0</version>
</project>
"""
);
@@ -940,11 +940,11 @@ public MockResponse dispatch(RecordedRequest request) {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openrewrite.test</groupId>
<artifactId>foo</artifactId>
<version>0.1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.foo</groupId>
@@ -1130,17 +1130,17 @@ void indirectBomImportedFromParent() {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>b</artifactId>
<groupId>org.openrewrite.maven</groupId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
@@ -1161,12 +1161,12 @@ void indirectBomImportedFromParent() {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>c</artifactId>
<groupId>org.openrewrite.maven</groupId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
<dependency>
@@ -1185,11 +1185,11 @@ void indirectBomImportedFromParent() {
"""
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.openrewrite.maven</groupId>
<artifactId>d</artifactId>
<version>0.1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
@@ -1406,7 +1406,7 @@ void dependencyManagementPropagatesToDependencies() {
<artifactId>a-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
<dependency>
@@ -1429,9 +1429,9 @@ void dependencyManagementPropagatesToDependencies() {
<version>0.1.0-SNAPSHOT</version>
<relativePath />
</parent>
<artifactId>a</artifactId>
<dependencies>
<dependency>
<groupId>org.openrewrite.maven</groupId>
@@ -1490,9 +1490,9 @@ void dependencyManagementPropagatesToDependencies() {
<version>0.1.0-SNAPSHOT</version>
<relativePath />
</parent>
<artifactId>b</artifactId>
<dependencies>
<dependency>
<groupId>org.openrewrite.maven</groupId>
@@ -1532,7 +1532,7 @@ void managedDependencyInTransitiveAndPom() {
<artifactId>a</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<dependencyManagement>
<dependencies>
<dependency>
@@ -1542,7 +1542,7 @@ void managedDependencyInTransitiveAndPom() {
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -1606,7 +1606,7 @@ void profileNoJdkActivation() {
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<profiles>
<profile>
<id>old-jdk</id>
@@ -1812,23 +1812,23 @@ void ciFriendlyVersionWithParent() {
<artifactId>sample</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<modules>
<module>sample-rest</module>
</modules>
</project>
""", spec -> spec.path("pom.xml")),
pomXml(
"""
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-rest</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>net.sample</groupId>
<artifactId>sample</artifactId>
@@ -1854,14 +1854,14 @@ void canConnectProjectPomsWhenUsingCiFriendlyVersions() {
<artifactId>sample</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<modules>
<module>sample-parent</module>
<module>sample-app</module>
<module>sample-rest</module>
<module>sample-web</module>
</modules>
<properties>
<revision>0.0.0-SNAPSHOT</revision>
</properties>
@@ -1877,11 +1877,11 @@ void canConnectProjectPomsWhenUsingCiFriendlyVersions() {
<groupId>net.sample</groupId>
<version>${revision}</version>
<packaging>pom</packaging>
<properties>
<revision>0.0.0-SNAPSHOT</revision>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
@@ -1903,24 +1903,24 @@ void canConnectProjectPomsWhenUsingCiFriendlyVersions() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-app</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>net.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>${revision}</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>net.sample</groupId>
<artifactId>sample-rest</artifactId>
</dependency>
<dependency>
<groupId>net.sample</groupId>
<artifactId>sample-web</artifactId>
@@ -1933,11 +1933,11 @@ void canConnectProjectPomsWhenUsingCiFriendlyVersions() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-rest</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>net.sample</groupId>
<artifactId>sample-parent</artifactId>
@@ -1951,11 +1951,11 @@ void canConnectProjectPomsWhenUsingCiFriendlyVersions() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-web</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>net.sample</groupId>
<artifactId>sample-parent</artifactId>
@@ -1982,14 +1982,14 @@ void ciFriendlyVersionsStillWorkAfterUpdateMavenModel() {
<artifactId>sample</artifactId>
<version>${revision}</version>
<packaging>pom</packaging>
<modules>
<module>sample-parent</module>
<module>sample-app</module>
<module>sample-rest</module>
<module>sample-web</module>
</modules>
<properties>
<revision>0.0.0-SNAPSHOT</revision>
</properties>
@@ -2005,11 +2005,11 @@ void ciFriendlyVersionsStillWorkAfterUpdateMavenModel() {
<groupId>net.sample</groupId>
<version>${revision}</version>
<packaging>pom</packaging>
<properties>
<revision>0.0.0-SNAPSHOT</revision>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
@@ -2031,29 +2031,29 @@ void ciFriendlyVersionsStillWorkAfterUpdateMavenModel() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-app</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>net.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>${revision}</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>net.sample</groupId>
<artifactId>sample-rest</artifactId>
</dependency>
<dependency>
<groupId>net.sample</groupId>
<artifactId>sample-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -2065,29 +2065,29 @@ void ciFriendlyVersionsStillWorkAfterUpdateMavenModel() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-app</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>net.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>${revision}</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>net.sample</groupId>
<artifactId>sample-rest</artifactId>
</dependency>
<dependency>
<groupId>net.sample</groupId>
<artifactId>sample-web</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -2101,11 +2101,11 @@ void ciFriendlyVersionsStillWorkAfterUpdateMavenModel() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-rest</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>net.sample</groupId>
<artifactId>sample-parent</artifactId>
@@ -2119,11 +2119,11 @@ void ciFriendlyVersionsStillWorkAfterUpdateMavenModel() {
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-web</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>net.sample</groupId>
<artifactId>sample-parent</artifactId>
@@ -2144,16 +2144,16 @@ void multipleCiFriendlyVersionPlaceholders() {
<?xml version="1.0" encoding="UTF-8"?>
<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>bogus.example</groupId>
<artifactId>parent</artifactId>
<version>${revision}${changelist}</version>
<packaging>pom</packaging>
<modules>
<module>sub</module>
</modules>
<properties>
<revision>99999.0</revision>
<changelist>-SNAPSHOT</changelist>
@@ -2166,13 +2166,13 @@ void multipleCiFriendlyVersionPlaceholders() {
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>bogus.example</groupId>
<artifactId>parent</artifactId>
<version>${revision}${changelist}</version>
</parent>
<artifactId>sub</artifactId>
</project>
""", spec -> spec.path("sub/pom.xml"))
@@ -2337,7 +2337,7 @@ void malformedPom() {
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -2360,7 +2360,7 @@ void plugins() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>a</artifactId>
<version>0.1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
@@ -2393,7 +2393,7 @@ void pluginWithoutConfig() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>a</artifactId>
<version>0.1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
@@ -2444,9 +2444,9 @@ void pluginsFromParent() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>b</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
@@ -2474,7 +2474,7 @@ void pluginManagement() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>a</artifactId>
<version>0.1.0-SNAPSHOT</version>
<build>
<pluginManagement>
<plugins>
@@ -2529,9 +2529,9 @@ void pluginManagementFromParent() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>b</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<pluginManagement>
<plugins>
@@ -2581,9 +2581,9 @@ void notInheritedPluginFromParent() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>b</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
@@ -2613,9 +2613,9 @@ void mergePluginConfig() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>b</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
@@ -2643,7 +2643,7 @@ void mergePluginConfig() {
<relativePath />
</parent>
<artifactId>a</artifactId>
<build>
<plugins>
<plugin>
@@ -2678,9 +2678,9 @@ void mergePluginConfigListOverride() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>b</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
@@ -2710,7 +2710,7 @@ void mergePluginConfigListOverride() {
<relativePath />
</parent>
<artifactId>a</artifactId>
<build>
<plugins>
<plugin>
@@ -2750,9 +2750,9 @@ void mergePluginConfigListAppend() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>b</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
@@ -2782,7 +2782,7 @@ void mergePluginConfigListAppend() {
<relativePath />
</parent>
<artifactId>a</artifactId>
<build>
<plugins>
<plugin>
@@ -2825,9 +2825,9 @@ void mergePluginConfigListAppendOverride() {
<groupId>org.openrewrite.maven</groupId>
<artifactId>b</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
@@ -2857,7 +2857,7 @@ void mergePluginConfigListAppendOverride() {
<relativePath />
</parent>
<artifactId>a</artifactId>
<build>
<plugins>
<plugin>
@@ -3115,18 +3115,18 @@ void circularMavenProperty() {
pomXml(
"""
<project>
<groupId>example</groupId>
<artifactId>example-root</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<properties>
<project.version>1.0.1</project.version>
</properties>
<modules>
<module>example-child</module>
</modules>
<groupId>example</groupId>
<artifactId>example-root</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<properties>
<project.version>1.0.1</project.version>
</properties>
<modules>
<module>example-child</module>
</modules>
</project>
""",
spec -> spec.afterRecipe(pomXml -> assertThat(
@@ -3138,20 +3138,20 @@ void circularMavenProperty() {
pomXml(
"""
<project>
<parent>
<groupId>example</groupId>
<artifactId>example-root</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>example-child</artifactId>
<version>${project.version}</version>
<parent>
<groupId>example</groupId>
<artifactId>example-root</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>example-child</artifactId>
<version>${project.version}</version>
</project>
""",
spec -> spec.afterRecipe(pomXml -> {
MavenResolutionResult resolution = pomXml.getMarkers().findFirst(MavenResolutionResult.class).orElseThrow();
assertThat(resolution.getPom().getVersion()).isEqualTo("1.0.1");
})
spec -> spec.afterRecipe(pomXml -> assertThat(
pomXml.getMarkers().findFirst(MavenResolutionResult.class).orElseThrow()
.getPom().getVersion())
.isEqualTo("1.0.1"))
)
)
)

0 comments on commit 18b434c

Please sign in to comment.