-
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.
Browse files
Browse the repository at this point in the history
Unregister Vert.x codecs in dev-mode
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
...ertx/deployment/src/test/java/io/quarkus/vertx/devmode/ConsumeUuidEventHotReloadTest.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,57 @@ | ||
package io.quarkus.vertx.devmode; | ||
|
||
import java.util.UUID; | ||
import java.util.concurrent.CountDownLatch; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.enterprise.event.Observes; | ||
import javax.inject.Inject; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusDevModeTest; | ||
import io.restassured.RestAssured; | ||
import io.vertx.core.Vertx; | ||
import io.vertx.ext.web.Router; | ||
|
||
public class ConsumeUuidEventHotReloadTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusDevModeTest test = new QuarkusDevModeTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(UuidMessageConsumer.class, BeanDeployingAVerticleFromInstance.class)); | ||
|
||
private static final String SAMPLE_UUID = "38400000-8cf0-11bd-b23e-10b96e4ef00d"; | ||
|
||
@Test | ||
public void testUuidMessageConsumption() { | ||
String resp = RestAssured.get("/").asString(); | ||
Assertions.assertEquals("test-" + SAMPLE_UUID, resp); | ||
test.modifySourceFile(UuidMessageConsumer.class, data -> data.replace("test-", "other-")); | ||
resp = RestAssured.get("/").asString(); | ||
Assertions.assertEquals("other-" + SAMPLE_UUID, resp); | ||
String resp2 = RestAssured.get("/").asString(); | ||
Assertions.assertEquals(resp, resp2); | ||
|
||
} | ||
|
||
@ApplicationScoped | ||
public static class BeanDeployingAVerticleFromInstance { | ||
@Inject | ||
Vertx vertx; | ||
|
||
public void init(@Observes Router router) throws InterruptedException { | ||
CountDownLatch latch = new CountDownLatch(1); | ||
vertx.deployVerticle(new MyVerticle(), | ||
ar -> latch.countDown()); | ||
router.get("/").handler(rc -> vertx.eventBus().<String> request("event", UUID.fromString(SAMPLE_UUID), | ||
ar -> rc.response().end(ar.result().body()))); | ||
latch.await(); | ||
} | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
extensions/vertx/deployment/src/test/java/io/quarkus/vertx/devmode/UuidMessageConsumer.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,16 @@ | ||
package io.quarkus.vertx.devmode; | ||
|
||
import java.util.UUID; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import io.quarkus.vertx.ConsumeEvent; | ||
|
||
@ApplicationScoped | ||
public class UuidMessageConsumer { | ||
|
||
@ConsumeEvent(value = "event", blocking = true) | ||
public String handleUuid(UUID uuid) { | ||
return "test-" + uuid.toString(); | ||
} | ||
} |
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