Skip to content

Commit

Permalink
Proof that javax.jms is migrated to jakarta.jms in spring.xml (#603)
Browse files Browse the repository at this point in the history
* This testcase should start working after ChangeType and ChangePackage adapt the new `SourceFileWithReference` construction

* Apply suggestions from code review

---------

Co-authored-by: Tim te Beek <[email protected]>
  • Loading branch information
Laurens-W and timtebeek authored Nov 14, 2024
1 parent 20b8fff commit 2ff26bc
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import static org.openrewrite.java.Assertions.*;
import static org.openrewrite.maven.Assertions.pomXml;
import static org.openrewrite.xml.Assertions.xml;

class JavaxToJakartaTest implements RewriteTest {

Expand Down Expand Up @@ -610,4 +611,35 @@ public class TestApplication {
)
);
}

@Test
void shouldRefactorSpringBeanXml() {
rewriteRun(
//language=XML
xml(
"""
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="exampleBean" class="org.springframework.beans.ExampleBean">
<property name="conFactory">
<value>javax.jms.ConnectionFactory</value>
</property>
</bean>
</beans>
""",
"""
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="exampleBean" class="org.springframework.beans.ExampleBean">
<property name="conFactory">
<value>jakarta.jms.ConnectionFactory</value>
</property>
</bean>
</beans>
"""
)
);
}
}

0 comments on commit 2ff26bc

Please sign in to comment.