-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Related to quarkusio#43704
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.quarkus.spring.web.deployment; | ||
|
||
import org.jboss.jandex.ClassInfo; | ||
import org.jboss.jandex.DotName; | ||
import org.jboss.resteasy.reactive.common.processor.EndpointAnnotationHandler; | ||
|
||
public class SpringRestControllerAnnotationHandler implements EndpointAnnotationHandler { | ||
public static final DotName SPRING_REST_CONTROLLER = DotName | ||
.createSimple("org.springframework.web.bind.annotation.RestController"); | ||
|
||
@Override | ||
public boolean isEndpointAnnotationValid(ClassInfo classInfo) { | ||
return classInfo | ||
.declaredAnnotation(SPRING_REST_CONTROLLER) != null; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.quarkus.spring.web.resteasy.reactive.test; | ||
Check failure on line 1 in extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/UnbuildableSpringRestControllerInterfaceTest.java GitHub Actions / Build summary for 7f52ed803e5f7c0cdde4c55c8286aa01c369c3c9JVM Tests - JDK 17
Raw output
Check failure on line 1 in extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/UnbuildableSpringRestControllerInterfaceTest.java GitHub Actions / Build summary for 7f52ed803e5f7c0cdde4c55c8286aa01c369c3c9JVM Tests - JDK 17 Windows
Raw output
Check failure on line 1 in extensions/spring-web/resteasy-reactive/tests/src/test/java/io/quarkus/spring/web/resteasy/reactive/test/UnbuildableSpringRestControllerInterfaceTest.java GitHub Actions / Build summary for 7f52ed803e5f7c0cdde4c55c8286aa01c369c3c9JVM Tests - JDK 21
Raw output
|
||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.fail; | ||
|
||
import jakarta.ws.rs.QueryParam; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import io.quarkus.test.QuarkusProdModeTest; | ||
|
||
public class UnbuildableSpringRestControllerInterfaceTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusProdModeTest config = new QuarkusProdModeTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(UnbuildableControllerInterface.class)) | ||
.setApplicationName("unbuildable-rest-controller-interface") | ||
.setApplicationVersion("0.1-SNAPSHOT") | ||
.assertBuildException(throwable -> { | ||
assertThat(throwable).isInstanceOf(RuntimeException.class); | ||
assertThat(throwable).hasMessageContaining( | ||
"Cannot have more than one of @PathParam, @QueryParam, @HeaderParam, @FormParam, @CookieParam, @BeanParam, @Context on method"); | ||
}); | ||
|
||
@Test | ||
public void testBuildLogs() { | ||
fail("Should not be called"); | ||
} | ||
|
||
@RestController | ||
@RequestMapping("/unbuildable") | ||
public interface UnbuildableControllerInterface { | ||
@GetMapping("/ping") | ||
String ping(); | ||
|
||
@PostMapping("/hello") | ||
String hello(@RequestParam(required = false) @QueryParam("dung") String params); | ||
|
||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.jboss.resteasy.reactive.common.processor; | ||
|
||
import java.lang.reflect.Modifier; | ||
|
||
import org.jboss.jandex.ClassInfo; | ||
|
||
public class DefaultEndpointAnnotationHandler implements EndpointAnnotationHandler { | ||
public DefaultEndpointAnnotationHandler() { | ||
} | ||
|
||
@Override | ||
public boolean isEndpointAnnotationValid(ClassInfo classInfo) { | ||
if (Modifier.isInterface(classInfo.flags()) || Modifier.isAbstract(classInfo.flags())) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.jboss.resteasy.reactive.common.processor; | ||
|
||
import org.jboss.jandex.ClassInfo; | ||
|
||
public interface EndpointAnnotationHandler { | ||
|
||
boolean isEndpointAnnotationValid(ClassInfo classInfo); | ||
|
||
} |