File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
main/resources/META-INF/rewrite
test/java/org/openrewrite/java/migrate/jakarta Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -170,15 +170,19 @@ recipeList:
170170 - org.openrewrite.xml.ChangeTagAttribute :
171171 attributeName : version
172172 elementName : web-app
173+ oldValue : ^[1234]\.\d+$
173174 newValue : 5.0
175+ regex : true
174176 - org.openrewrite.xml.ChangeTagAttribute :
175177 attributeName : xmlns
176178 elementName : web-app
177179 newValue : https://jakarta.ee/xml/ns/jakartaee
178180 - org.openrewrite.xml.ChangeTagAttribute :
179181 attributeName : xsi:schemaLocation
180182 elementName : web-app
183+ oldValue : .*xml/ns/javaee.*
181184 newValue : https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd
185+ regex : true
182186 - org.openrewrite.text.FindAndReplace :
183187 find : " javax."
184188 replace : " jakarta."
Original file line number Diff line number Diff line change @@ -193,11 +193,15 @@ recipeList:
193193 - org.openrewrite.xml.ChangeTagAttribute :
194194 attributeName : version
195195 elementName : web-app
196+ oldValue : ^[12345]\.\d+$
196197 newValue : 6.0
198+ regex : true
197199 - org.openrewrite.xml.ChangeTagAttribute :
198200 attributeName : xsi:schemaLocation
199201 elementName : web-app
200- newValue : https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd
202+ oldValue : (?s)(?<prefix>.*https://jakarta\.ee/xml/ns/jakartaee/web-app_)5_\d+(?<suffix>\.xsd.*)
203+ newValue : ${prefix}6_0${suffix}
204+ regex : true
201205---
202206type : specs.openrewrite.org/v1beta/recipe
203207name : org.openrewrite.java.migrate.jakarta.FacesManagedBeansRemoved
Original file line number Diff line number Diff line change @@ -161,5 +161,25 @@ void fileNotWebXml() {
161161 )
162162 );
163163 }
164+
165+ @ Test
166+ void alreadyMigrated () {
167+ rewriteRun (
168+ //language=xml
169+ xml (
170+ """
171+ <?xml version="1.0" encoding="UTF-8"?>
172+ <web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
173+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
174+ xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
175+ https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
176+ version="5.0">
177+ <display-name>Unit testing</display-name>
178+ </web-fragment>
179+ """ ,
180+ sourceSpecs -> sourceSpecs .path ("web.xml" )
181+ )
182+ );
183+ }
164184 }
165185}
You can’t perform that action at this time.
0 commit comments