Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WINDUPRULE-1019] adds eap 8 ruleset deprecated-initialcontextfactory… #1044

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<ruleset xmlns="http://windup.jboss.org/schema/jboss-ruleset" id="deprecated-initialcontextfactory-is-removed"
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 change their sources due to the removal of deprecated InitialContextFactory class.
</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" />
<addon id="org.jboss.windup.rules,windup-rules-xml,3.0.0.Final" />
</dependencies>
<sourceTechnology id="eap" versionRange="[6,8)" />
<targetTechnology id="eap" versionRange="[8,)" />
</metadata>
<rules>
<rule id="deprecated-initialcontextfactory-is-removed-00001">
<when>
<or>
<javaclass references="org.jboss.naming.remote.client.InitialContextFactory" />
<filecontent pattern='"org.jboss.naming.remote.client.InitialContextFactory"' filename="{*}.java"/>
<filecontent pattern="org.jboss.naming.remote.client.InitialContextFactory" filename="{*}.wsdl"/>
</or>
</when>
<perform>
<hint title="Class org.jboss.naming.remote.client.InitialContextFactory has been removed" effort="1" category-id="mandatory">
<message>Replace this class with `org.wildfly.naming.client.WildFlyInitialContextFactory`.</message>
<tag>JakartaEE</tag>
</hint>
</perform>
</rule>
</rules>
</ruleset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import org.jboss.naming.remote.client.InitialContextFactory;

public class DeprecatedInitialcontextfactoryIsRemoved {

String propertyValue = "org.jboss.naming.remote.client.InitialContextFactory";

public String getDeprecatedClassName() {
return InitialContextFactory.class.getName();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<definitions name = "HelloService"
targetNamespace = "http://www.examples.com/wsdl/HelloService.wsdl"
xmlns = "http://schemas.xmlsoap.org/wsdl/"
xmlns:soapjms = "http://schemas.xmlsoap.org/wsdl/soap/">
<service name="exampleService">
<soapjms:jndiInitialContextFactory>org.jboss.naming.remote.client.InitialContextFactory</soapjms:jndiInitialContextFactory>
</service>
</definitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<ruletest id="deprecated-initialcontextfactory-is-removed-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/deprecated-initialcontextfactory-is-removed</testDataPath>
<rulePath>../deprecated-initialcontextfactory-is-removed.windup.xml</rulePath>
<ruleset>
<rules>
<rule id="deprecated-initialcontextfactory-is-removed-00001-test">
<when>
<not>
<iterable-filter size="3">
<hint-exists message="Replace this class with `org.wildfly.naming.client.WildFlyInitialContextFactory`."/>
</iterable-filter>
</not>
</when>
<perform>
<fail message="[deprecated-initialcontextfactory-is-removed-00001] The hint was not found!" />
</perform>
</rule>
</rules>
</ruleset>
</ruletest>
Loading