Skip to content

Commit 2ff26bc

Browse files
Laurens-Wtimtebeek
andauthored
Proof that javax.jms is migrated to jakarta.jms in spring.xml (#603)
* 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]>
1 parent 20b8fff commit 2ff26bc

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/test/java/org/openrewrite/java/migrate/jakarta/JavaxToJakartaTest.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import static org.openrewrite.java.Assertions.*;
2727
import static org.openrewrite.maven.Assertions.pomXml;
28+
import static org.openrewrite.xml.Assertions.xml;
2829

2930
class JavaxToJakartaTest implements RewriteTest {
3031

@@ -610,4 +611,35 @@ public class TestApplication {
610611
)
611612
);
612613
}
614+
615+
@Test
616+
void shouldRefactorSpringBeanXml() {
617+
rewriteRun(
618+
//language=XML
619+
xml(
620+
"""
621+
<?xml version="1.0" encoding="UTF-8"?>
622+
<beans xmlns="http://www.springframework.org/schema/beans"
623+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
624+
<bean id="exampleBean" class="org.springframework.beans.ExampleBean">
625+
<property name="conFactory">
626+
<value>javax.jms.ConnectionFactory</value>
627+
</property>
628+
</bean>
629+
</beans>
630+
""",
631+
"""
632+
<?xml version="1.0" encoding="UTF-8"?>
633+
<beans xmlns="http://www.springframework.org/schema/beans"
634+
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
635+
<bean id="exampleBean" class="org.springframework.beans.ExampleBean">
636+
<property name="conFactory">
637+
<value>jakarta.jms.ConnectionFactory</value>
638+
</property>
639+
</bean>
640+
</beans>
641+
"""
642+
)
643+
);
644+
}
613645
}

0 commit comments

Comments
 (0)