What version of OpenRewrite are you using?
I am using main
How are you running OpenRewrite?
unit tests
What is the smallest, simplest way to reproduce the problem?
@Test
void deleteParentProperty_properties() {
rewriteRun(
spec -> spec.recipe(new DeleteSpringProperty("server.servlet.session.cookie")),
//language=properties
properties(
"""
some=value
server.servlet.session.cookie.name=fred
server.servlet.session.cookie.path=/cookie-monster
other=value
""",
"""
some=value
other=value
"""
)
);
}
@Test
void deleteParentProperty_yaml() {
rewriteRun(
spec -> spec.recipe(new DeleteSpringProperty("server.servlet.session.cookie")),
//language=yaml
yaml(
"""
some: value
server:
servlet:
session:
cookie:
name: fred
path: /cookie-monster
other: value
""",
"""
some: value
other: value
"""
)
);
}
@Test
void deleteParentProperty_yamlCoalesced() {
rewriteRun(
spec -> spec.recipe(new DeleteSpringProperty("server.servlet.session.cookie")),
//language=yaml
yaml(
"""
some: value
server.servlet.session.cookie.name: fred
server.servlet.session.cookie.path: /cookie-monster
other: value
""",
"""
some: value
other: value
"""
)
);
}
@Test
void deleteParentPropertyViaGlob_properties() {
rewriteRun(
spec -> spec.recipe(new DeleteSpringProperty("server.servlet.session.cookie.*")),
//language=properties
properties(
"""
some=value
server.servlet.session.cookie.name=fred
server.servlet.session.cookie.path=/cookie-monster
other=value
""",
"""
some=value
other=value
"""
)
);
}
@Test
void deleteParentPropertyViaGlob_yaml() {
rewriteRun(
spec -> spec.recipe(new DeleteSpringProperty("server.servlet.session.cookie.*")),
//language=yaml
yaml(
"""
some: value
server:
servlet:
session:
cookie:
name: fred
path: /cookie-monster
other: value
""",
"""
some: value
other: value
"""
)
);
}
@Test
void deleteParentPropertyViaGlob_yamlCoalesced() {
rewriteRun(
spec -> spec.recipe(new DeleteSpringProperty("server.servlet.session.cookie.*")),
//language=yaml
yaml(
"""
some: value
server.servlet.session.cookie.name: fred
server.servlet.session.cookie.path: /cookie-monster
other: value
""",
"""
some: value
other: value
"""
)
);
}
What did you expect to see?
one of those two sets of tests (either using glob or not using glob) to pass, given that the recipe advertises glob support:
@Option(displayName = "Property key",
description = "The property key to delete. Supports glob expressions",
example = "management.endpoint.configprops.*")
String propertyKey;
What did you see instead?
A mix of success and failure for both approaches:
- fail: deleteParentProperty_properties
- pass: deleteParentProperty_yaml
- fail: deleteParentProperty_yamlCoalesced
- pass: deleteParentPropertyViaGlob_properties
- fail: deleteParentPropertyViaGlob_yaml
- fail: deleteParentPropertyViaGlob_yamlCoalesced
What is the full stack trace of any errors you encountered?
no stack traces; failing test cases all failed with no changes
I think if we go fix #581, then for this issue we could mostly port the "targeting" logic over from ChangeSpringPropertyKey.
and similar to 581, I've got some time this week and will probably play with it.
What version of OpenRewrite are you using?
I am using
mainHow are you running OpenRewrite?
unit tests
What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
one of those two sets of tests (either using glob or not using glob) to pass, given that the recipe advertises glob support:
What did you see instead?
A mix of success and failure for both approaches:
What is the full stack trace of any errors you encountered?
no stack traces; failing test cases all failed with no changes
Are you interested in contributing a fix to OpenRewrite?
I think if we go fix #581, then for this issue we could mostly port the "targeting" logic over from
ChangeSpringPropertyKey.and similar to 581, I've got some time this week and will probably play with it.