File tree Expand file tree Collapse file tree
main/resources/META-INF/rewrite
test/java/org/openrewrite/java/migrate/jakarta Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,6 +197,8 @@ tags:
197197 - faces
198198 - jsf
199199preconditions :
200+ - org.openrewrite.FindSourceFiles :
201+ filePattern : ' **/web.xml'
200202 - org.openrewrite.Singleton
201203recipeList :
202204 - org.openrewrite.xml.ChangeTagAttribute :
@@ -215,14 +217,16 @@ recipeList:
215217 oldValue : (?s).*xml/ns/javaee.*
216218 newValue : https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd
217219 regex : true
218- - org.openrewrite.text.FindAndReplace :
219- find : " javax."
220- replace : " jakarta."
221- filePattern : ' **/web.xml'
222- - org.openrewrite.text.FindAndReplace :
223- find : " jakarta.sql."
224- replace : " javax.sql."
225- filePattern : ' **/web.xml'
220+ - org.openrewrite.xml.ChangeTagValue :
221+ elementName : //*
222+ oldValue : " javax\\ ."
223+ newValue : " jakarta."
224+ regex : true
225+ - org.openrewrite.xml.ChangeTagValue :
226+ elementName : //*
227+ oldValue : " jakarta\\ .sql\\ ."
228+ newValue : " javax.sql."
229+ regex : true
226230---
227231type : specs.openrewrite.org/v1beta/recipe
228232name : org.openrewrite.java.migrate.jakarta.JakartaFacesEcmaScript
Original file line number Diff line number Diff line change @@ -179,6 +179,43 @@ void migrateMultilineSchemaLocation() {
179179 );
180180 }
181181
182+ @ Test
183+ void jakartaEE10UpdatesWebXmlToVersion6AfterJavaxReplacement () {
184+ rewriteRun (
185+ spec -> spec .recipeFromResources ("org.openrewrite.java.migrate.jakarta.JakartaEE10" ),
186+ //language=xml
187+ xml (
188+ """
189+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
190+ <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
191+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
192+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
193+ version="4.0">
194+ <display-name>example-project</display-name>
195+ <context-param>
196+ <param-name>javax.faces.PROJECT_STAGE</param-name>
197+ <param-value>Production</param-value>
198+ </context-param>
199+ </web-app>
200+ """ ,
201+ """
202+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
203+ <web-app xmlns="https://jakarta.ee/xml/ns/jakartaee"
204+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
205+ xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
206+ version="6.0">
207+ <display-name>example-project</display-name>
208+ <context-param>
209+ <param-name>jakarta.faces.PROJECT_STAGE</param-name>
210+ <param-value>Production</param-value>
211+ </context-param>
212+ </web-app>
213+ """ ,
214+ sourceSpecs -> sourceSpecs .path ("src/main/webapp/WEB-INF/web.xml" )
215+ )
216+ );
217+ }
218+
182219 @ Nested
183220 class NoChanges {
184221 @ Test
You can’t perform that action at this time.
0 commit comments