Skip to content

Commit

Permalink
[WINDUPRULE-1014] Create ruleset for EAP 7.1 Elytron migration (#1014)
Browse files Browse the repository at this point in the history
* [WINDUPRULE-1014] Create ruleset for EAP 7.1 Elytron migration

* [WINDUPRULE-1014] Fix version range

* [WINDUPRULE-1014] Set rule as potential

* [WINDUPRULE-1029] Switch rule to filecontent
  • Loading branch information
jmle committed Jul 31, 2023
1 parent c52cbe0 commit 0b61983
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 23 deletions.
46 changes: 46 additions & 0 deletions rules/rules-reviewed/eap7/elytron/elytron.windup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0"?>
<ruleset xmlns="http://windup.jboss.org/schema/jboss-ruleset" id="elytron-eap71"
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 applications that Picketlink STS and may require
This ruleset provides analysis to migrate to Elytron in JBoss EAP 7.1
</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>
<sourceTechnology id="eap" versionRange="(,7.1)" />
<targetTechnology id="eap" versionRange="[7.1,)" />
<tag>eap7</tag>
</metadata>
<rules>
<rule id="elytron-eap71-00000">
<when>
<filecontent pattern="&quot;org.jboss.naming.remote.client.InitialContextFactory&quot;"/>
</when>
<perform>
<hint title="Migrate a Naming Client Configuration to Elytron" effort="3" category-id="potential">
<message>
Migrate a client application that performs a remote JNDI lookup using an `org.jboss.naming.remote.client.InitialContext` class, which is backed by an `org.jboss.naming.remote.client.InitialContextFactory` class, to Elytron.
</message>
<link href="https://access.redhat.com/documentation/es-es/red_hat_jboss_enterprise_application_platform/7.2/html/migration_guide/migrating_to_elytron#migrate_naming_client_configuration_to_elytron" title="Migrate a Naming Client Configuration to Elytron"/>
</hint>
</perform>
</rule>
<rule id="elytron-eap71-00010">
<when>
<file filename="jboss-ejb-client.properties"/>
</when>
<perform>
<hint title="Migrate an EJB Client to Elytron" effort="3" category-id="potential">
<message>
Remote EJB client must be configured following one of the two options defined in the link below.
</message>
<link href="https://access.redhat.com/documentation/es-es/red_hat_jboss_enterprise_application_platform/7.2/html/migration_guide/migrating_to_elytron#migrate_security_ejb_client_to_elytron" title="Migrate an EJB Client to Elytron"/>
</hint>
</perform>
</rule>
</rules>
</ruleset>
17 changes: 17 additions & 0 deletions rules/rules-reviewed/eap7/elytron/tests/data/Elytron.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import org.jboss.naming.remote.client.InitialContextFactory;

import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
import java.util.Hashtable;

public class Elytron {
public static void main(String[] args) {
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL,"http-remoting://127.0.0.1:8080");
properties.put(Context.SECURITY_PRINCIPAL, "bob");
properties.put(Context.SECURITY_CREDENTIALS, "secret");
InitialContext context = new InitialContext(properties);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=127.0.0.1
remote.connection.default.port = 8080
remote.connection.default.username=bob
remote.connection.default.password=secret
35 changes: 35 additions & 0 deletions rules/rules-reviewed/eap7/elytron/tests/elytron.windup.test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<ruletest xmlns="http://windup.jboss.org/schema/jboss-ruleset"
id="elytron-eap71-test" 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</testDataPath>
<rulePath>../elytron.windup.xml</rulePath>
<ruleset>
<rules>
<rule id="elytron-eap71-00000-test">
<when>
<not>
<iterable-filter size="1">
<hint-exists message="Migrate a client application that performs a remote JNDI lookup using an `org.jboss.naming.remote.client.InitialContext` class, which is backed by an `org.jboss.naming.remote.client.InitialContextFactory` class, to Elytron." />
</iterable-filter>
</not>
</when>
<perform>
<fail message="elytron-eap71-00000 rule hint was not found!" />
</perform>
</rule>
<rule id="elytron-eap71-00010-test">
<when>
<not>
<iterable-filter size="1">
<hint-exists message="Remote EJB client must be configured following one of the two options defined in the link below." />
</iterable-filter>
</not>
</when>
<perform>
<fail message="elytron-eap71-00010 rule hint was not found!" />
</perform>
</rule>
</rules>
</ruleset>
</ruletest>

This file was deleted.

0 comments on commit 0b61983

Please sign in to comment.