Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-scm-url-component-detection-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
pstreef authored Aug 2, 2024
2 parents 4c2387c + 65fb0cf commit 4fef5be
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.openrewrite.maven;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
import org.openrewrite.*;
import org.openrewrite.internal.StringUtils;
Expand Down Expand Up @@ -65,8 +66,11 @@ public class AddRuntimeConfig extends ScanningRecipe<AddRuntimeConfig.Accumulato

@Getter
public enum Separator {
@JsonProperty("")
NONE(""),
@JsonProperty(" ")
SPACE(" "),
@JsonProperty("=")
EQUALS("=");

private final String notation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.junit.jupiter.params.provider.EnumSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.openrewrite.DocumentExample;
import org.openrewrite.Issue;
import org.openrewrite.test.RewriteTest;
import org.openrewrite.test.SourceSpecs;

Expand Down Expand Up @@ -52,6 +53,32 @@ void createConfigFileWithRuntimeConfigIfFileDoesNotExist() {
);
}

@Test
@Issue("https://github.com/openrewrite/rewrite/issues/4368")
void fromYaml() {
rewriteRun(
spec -> spec.recipeFromYaml(
"""
type: specs.openrewrite.org/v1beta/recipe
name: org.test.AddRuntimeConfig
description: Test deserialization.
recipeList:
- org.openrewrite.maven.AddRuntimeConfig:
relativeConfigFileName: maven.config
flag: -T
argument: 3
separator: '='
""", "org.test.AddRuntimeConfig"
),
POM_XML_SOURCE_SPEC,
text(
null,
"-T=3",
spec -> spec.path(MAVEN_CONFIG_PATH)
)
);
}

@Test
void appendRuntimeFlagToEmptyConfigFile() {
rewriteRun(
Expand Down

0 comments on commit 4fef5be

Please sign in to comment.