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

[releases/6.3.z] WINDUPRULE-1041 jakarta jaxrs to quarkus rules (#1058) #1059

Merged
merged 1 commit into from
Jan 17, 2024
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,51 @@
<?xml version="1.0"?>
<ruleset xmlns="http://windup.jboss.org/schema/jboss-ruleset" id="jakarta-jaxrs-to-quarkus"
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 gives hints to migrate JAX-RS applications to Quarkus extension
</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="java-ee" />
<targetTechnology id="quarkus" />
</metadata>
<rules>
<rule id="jakarta-jaxrs-to-quarkus-00010">
<when>
<project><artifact groupId="jakarta.ws.rs" artifactId="jakarta.ws.rs-api" /></project>
</when>
<perform>
<hint title="Replace jakarta JAX-RS dependency" effort="1" category-id="mandatory">
<message>
Dependency `jakarta.ws.rs:jakarta.ws.rs-api` has to be replaced with `io.quarkus:quarkus-resteasy-reactive` artifact.
</message>
<link title="Quarkus - Guide" href="https://quarkus.io/guides/resteasy-reactive" />
</hint>
</perform>
</rule>
<rule id="jakarta-jaxrs-to-quarkus-00020">
<when>
<and>
<javaclass references="jakarta.ws.rs.ApplicationPath">
<location>ANNOTATION</location>
</javaclass>
<javaclass references="jakarta.ws.rs.core.Application">
<location>INHERITANCE</location>
</javaclass>
</and>
</when>
<perform>
<hint title="Jakarta JAX-RS activation is no longer necessary" effort="1" category-id="optional">
<message>
Jakarta JAX-RS activation is no longer necessary. You can set a root path like this but you don't have to.
</message>
<link title="Quarkus - Guide" href="https://quarkus.io/guides/resteasy-reactive#declaring-endpoints-uri-mapping" />
</hint>
</perform>
</rule>
</rules>
</ruleset>
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
<version>9.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>jakarta.faces</groupId>
<artifactId>jakarta.faces-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* JBoss, Home of Professional Open Source
* Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual
* contributors by the @authors tag. See the copyright.txt in the
* distribution for a full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jakarta.quickstarts.rshelloworld;

import jakarta.ws.rs.ApplicationPath;
import jakarta.ws.rs.core.Application;

/**
* JAXActivator is an arbitrary name, what is important is that jakarta.ws.rs.core.Application is extended
* and the @ApplicationPath annotation is used with a "rest" path. Without this the rest routes linked to
* from index.html would not be found.
*/
@ApplicationPath("rest")
public class JAXActivator extends Application {
// Left empty intentionally
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<ruletest id="jakarta-jaxrs-to-quarkus-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/application-jakarta-api/*</testDataPath>
<rulePath>../jakarta-jaxrs-to-quarkus.windup.xml</rulePath>
<ruleset>
<rules>
<rule id="jakarta-jaxrs-to-quarkus-00010-test">
<when>
<not>
<iterable-filter size="1">
<hint-exists message="Dependency `jakarta.ws.rs:jakarta.ws.rs-api` has to be replaced with `io.quarkus:quarkus-resteasy-reactive` artifact."/>
</iterable-filter>
</not>
</when>
<perform>
<fail message="[jakarta-jaxrs-to-quarkus-00010] jakarta.ws.rs-api dependency hint was not found!" />
</perform>
</rule>
<rule id="jakarta-jaxrs-to-quarkus-00020-test">
<when>
<not>
<iterable-filter size="2">
<hint-exists message="Jakarta JAX-RS activation is no longer necessary."/>
</iterable-filter>
</not>
</when>
<perform>
<fail message="[jakarta-jaxrs-to-quarkus-00020] Jakarta JAX-RS activation hint was not found!" />
</perform>
</rule>
</rules>
</ruleset>
</ruletest>