-
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.
Browse files
Browse the repository at this point in the history
(cherry picked from commit 8d5aa62) Co-authored-by: Mark Brophy <36955467+m-brophy@users.noreply.github.com>
- Loading branch information
1 parent
deb131c
commit cf253bc
Showing
4 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
rules/rules-reviewed/quarkus/java-ee/jakarta-jaxrs-to-quarkus.windup.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,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> |
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
30 changes: 30 additions & 0 deletions
30
...quarkus/java-ee/tests/data/application-jakarta-api/src/main/java/sample/JAXActivator.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,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 | ||
} |
36 changes: 36 additions & 0 deletions
36
rules/rules-reviewed/quarkus/java-ee/tests/jakarta-jaxrs-to-quarkus.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,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> |