Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/resources/META-INF/rewrite/jakarta-faces-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,19 @@ recipeList:
- org.openrewrite.xml.ChangeTagAttribute:
attributeName: version
elementName: web-app
oldValue: ^[1234]\.\d+$
newValue: 5.0
regex: true
- org.openrewrite.xml.ChangeTagAttribute:
attributeName: xmlns
elementName: web-app
newValue: https://jakarta.ee/xml/ns/jakartaee
- org.openrewrite.xml.ChangeTagAttribute:
attributeName: xsi:schemaLocation
elementName: web-app
oldValue: .*xml/ns/javaee.*
newValue: https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd
regex: true
- org.openrewrite.text.FindAndReplace:
find: "javax."
replace: "jakarta."
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/META-INF/rewrite/jakarta-faces-4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,15 @@ recipeList:
- org.openrewrite.xml.ChangeTagAttribute:
attributeName: version
elementName: web-app
oldValue: ^[12345]\.\d+$
newValue: 6.0
regex: true
- org.openrewrite.xml.ChangeTagAttribute:
attributeName: xsi:schemaLocation
elementName: web-app
newValue: https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd
oldValue: (?s)(?<prefix>.*https://jakarta\.ee/xml/ns/jakartaee/web-app_)5_\d+(?<suffix>\.xsd.*)
newValue: ${prefix}6_0${suffix}
regex: true
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.jakarta.FacesManagedBeansRemoved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,25 @@ void fileNotWebXml() {
)
);
}

@Test
void alreadyMigrated() {
rewriteRun(
//language=xml
xml(
"""
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
<display-name>Unit testing</display-name>
</web-fragment>
""",
sourceSpecs -> sourceSpecs.path("web.xml")
)
);
}
}
}