-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19601 from geoand/blocking-nonblocking
Make the use of @Blocking and @nonblocking a build time error
- Loading branch information
Showing
5 changed files
with
159 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...io/quarkus/resteasy/reactive/server/test/BothBlockingAndNonBlockingOnApplicationTest.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,53 @@ | ||
package io.quarkus.resteasy.reactive.server.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import javax.enterprise.inject.spi.DeploymentException; | ||
import javax.ws.rs.ApplicationPath; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.core.Application; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.smallrye.common.annotation.Blocking; | ||
import io.smallrye.common.annotation.NonBlocking; | ||
|
||
public class BothBlockingAndNonBlockingOnApplicationTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setArchiveProducer(new Supplier<>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(Resource.class, MyApplication.class); | ||
} | ||
}).setExpectedException(DeploymentException.class); | ||
|
||
@Test | ||
public void test() { | ||
fail("Should never have been called"); | ||
} | ||
|
||
@Path("test") | ||
public static class Resource { | ||
|
||
@Path("hello") | ||
public String hello() { | ||
return "hello"; | ||
} | ||
} | ||
|
||
@ApplicationPath("/app") | ||
@Blocking | ||
@NonBlocking | ||
public static class MyApplication extends Application { | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
.../java/io/quarkus/resteasy/reactive/server/test/BothBlockingAndNonBlockingOnClassTest.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,46 @@ | ||
package io.quarkus.resteasy.reactive.server.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import javax.enterprise.inject.spi.DeploymentException; | ||
import javax.ws.rs.Path; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.smallrye.common.annotation.Blocking; | ||
import io.smallrye.common.annotation.NonBlocking; | ||
|
||
public class BothBlockingAndNonBlockingOnClassTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setArchiveProducer(new Supplier<>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(Resource.class); | ||
} | ||
}).setExpectedException(DeploymentException.class); | ||
|
||
@Test | ||
public void test() { | ||
fail("Should never have been called"); | ||
} | ||
|
||
@Path("test") | ||
@Blocking | ||
@NonBlocking | ||
public static class Resource { | ||
|
||
@Path("hello") | ||
public String hello() { | ||
return "hello"; | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...java/io/quarkus/resteasy/reactive/server/test/BothBlockingAndNonBlockingOnMethodTest.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,46 @@ | ||
package io.quarkus.resteasy.reactive.server.test; | ||
|
||
import static org.junit.jupiter.api.Assertions.fail; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import javax.enterprise.inject.spi.DeploymentException; | ||
import javax.ws.rs.Path; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.smallrye.common.annotation.Blocking; | ||
import io.smallrye.common.annotation.NonBlocking; | ||
|
||
public class BothBlockingAndNonBlockingOnMethodTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setArchiveProducer(new Supplier<>() { | ||
@Override | ||
public JavaArchive get() { | ||
return ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(Resource.class); | ||
} | ||
}).setExpectedException(DeploymentException.class); | ||
|
||
@Test | ||
public void test() { | ||
fail("Should never have been called"); | ||
} | ||
|
||
@Path("test") | ||
public static class Resource { | ||
|
||
@Path("hello") | ||
@Blocking | ||
@NonBlocking | ||
public String hello() { | ||
return "hello"; | ||
} | ||
} | ||
} |
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
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