-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WINDUPRULE-911] Rules for Jakarta SOAP 3.0 (#863)
* [WINDUPRULE-911] Rules for Jakarta SOAP 3.0 * [WINDUPRULE-911] Fix test * Fix javax-to-jakarta-package.windup.test.xml hints --------- Co-authored-by: carlosthe19916 <2582866+carlosthe19916@users.noreply.github.com>
- Loading branch information
1 parent
2d706b6
commit 3bbf0be
Showing
4 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0"?> | ||
<ruleset xmlns="http://windup.jboss.org/schema/jboss-ruleset" id="jakarta-soap" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd"> | ||
<metadata> | ||
<description> | ||
This ruleset provides analysis of Java EE applications that need to migrate to Jakarta SOAP with Attachments 3.0. | ||
</description> | ||
<dependencies> | ||
<addon id="org.jboss.windup.rules,windup-rules-javaee,3.0.0.Final" /> | ||
<addon id="org.jboss.windup.rules,windup-rules-java,3.0.0.Final" /> | ||
</dependencies> | ||
<targetTechnology id="eap" versionRange="[8,9)" /> | ||
</metadata> | ||
<rules> | ||
<rule id="jakarta-soap-00010"> | ||
<when> | ||
<javaclass references="javax.xml.soap.SOAPElementFactory.newInstance({*})"/> | ||
</when> | ||
<perform> | ||
<hint title="javax.xml.soap.SOAPElementFactory.newInstance() must be replaced" effort="1" category-id="mandatory"> | ||
<message>`javax.xml.soap.SOAPElementFactory.newInstance()` must be replaced with `jakarta.xml.soap.SOAPFactory.newInstance()`.</message> | ||
</hint> | ||
</perform> | ||
</rule> | ||
<rule id="jakarta-soap-00020"> | ||
<when> | ||
<javaclass references="javax.xml.soap.SOAPElementFactory.create({*})"> | ||
<location>METHOD_CALL</location> | ||
</javaclass> | ||
</when> | ||
<perform> | ||
<hint title="javax.xml.soap.SOAPElementFactory.create() must be replaced" effort="1" category-id="mandatory"> | ||
<message>`javax.xml.soap.SOAPElementFactory.create()` must be replaced with `jakarta.xml.soap.SOAPFactory.createElement()`. If `javax.xml.soap.Name` is passed as a parameter, it must be replaced with `jakarta.xml.soap.Name`.</message> | ||
</hint> | ||
</perform> | ||
</rule> | ||
</rules> | ||
</ruleset> |
14 changes: 14 additions & 0 deletions
14
rules/rules-reviewed/eap8/eap7/tests/data/jakarta-soap/JakartaSOAP.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import javax.xml.soap.SOAPElementFactory; | ||
import javax.xml.soap.Name; | ||
|
||
public class JakartaSOAP { | ||
|
||
public static void main(String[] args) { | ||
SOAPElementFactory factory = SOAPElementFactory.newInstance(); | ||
|
||
Name name = null; | ||
factory.create(name); | ||
factory.create("name"); | ||
factory.create("name", "name", "name"); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
rules/rules-reviewed/eap8/eap7/tests/jakarta-soap.windup.test.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0"?> | ||
<ruletest id="jakarta-soap-tests" | ||
xmlns="http://windup.jboss.org/schema/jboss-ruleset" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd"> | ||
<testDataPath>data/jakarta-soap</testDataPath> | ||
<rulePath>../jakarta-soap.windup.xml</rulePath> | ||
<ruleset> | ||
<rules> | ||
<rule id="jakarta-soap-00010-test"> | ||
<when> | ||
<not> | ||
<hint-exists message="`javax.xml.soap.SOAPElementFactory.newInstance\(\)` must be replaced with `jakarta.xml.soap.SOAPFactory.newInstance\(\)`."/> | ||
</not> | ||
</when> | ||
<perform> | ||
<fail message="[jakarta-soap-00010] The hint was not found!" /> | ||
</perform> | ||
</rule> | ||
<rule id="jakarta-soap-00020-test"> | ||
<when> | ||
<not> | ||
<iterable-filter size="3"> | ||
<hint-exists message="`javax.xml.soap.SOAPElementFactory.create\(\)` must be replaced with `jakarta.xml.soap.SOAPFactory.createElement\(\)`. If `javax.xml.soap.Name` is passed as a parameter, it must be replaced with `jakarta.xml.soap.Name`."/> | ||
</iterable-filter> | ||
</not> | ||
</when> | ||
<perform> | ||
<fail message="[jakarta-soap-00020] The hint was not found!" /> | ||
</perform> | ||
</rule> | ||
</rules> | ||
</ruleset> | ||
</ruletest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters