-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 #16164 from ebullient/micrometer-cdi
Micrometer: Simplify Vertx HTTP binder init; http settings in dev mode
- Loading branch information
Showing
13 changed files
with
201 additions
and
195 deletions.
There are no files selected for viewing
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
46 changes: 46 additions & 0 deletions
46
...ployment/src/test/java/io/quarkus/micrometer/deployment/binder/HttpDevModeConfigTest.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.micrometer.deployment.binder; | ||
|
||
import static io.restassured.RestAssured.when; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.micrometer.test.HelloResource; | ||
import io.quarkus.test.QuarkusDevModeTest; | ||
|
||
public class HttpDevModeConfigTest { | ||
@RegisterExtension | ||
static final QuarkusDevModeTest test = new QuarkusDevModeTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClass(HelloResource.class) | ||
.add(new StringAsset("quarkus.micrometer.binder-enabled-default=false\n" + | ||
"quarkus.micrometer.binder.http-client.enabled=true\n" + | ||
"quarkus.micrometer.binder.http-server.enabled=true\n" + | ||
"quarkus.micrometer.binder.http-server.ignore-patterns=/http\n" + | ||
"quarkus.micrometer.binder.vertx.enabled=true\n"), "application.properties")); | ||
|
||
@Test | ||
public void testHttpConfigInDevMode() throws Exception { | ||
|
||
when().get("/hello/one").then().statusCode(200); | ||
when().get("/hello/two").then().statusCode(200); | ||
when().get("/hello/three").then().statusCode(200); | ||
when().get("/q/metrics").then().statusCode(200) | ||
.body(Matchers.containsString("/hello/{message}")); | ||
|
||
test.modifyResourceFile("application.properties", | ||
s -> s.replace("quarkus.micrometer.binder.http-server.ignore-patterns=/http", | ||
"quarkus.micrometer.binder.http-server.match-patterns=/hello/.*=/goodbye/{message}")); | ||
|
||
when().get("/hello/one").then().statusCode(200); | ||
when().get("/hello/two").then().statusCode(200); | ||
when().get("/hello/three").then().statusCode(200); | ||
when().get("/q/metrics").then().statusCode(200) | ||
.body(Matchers.containsString("/goodbye/{message}")); | ||
} | ||
|
||
} |
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
16 changes: 16 additions & 0 deletions
16
extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/test/HelloResource.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.micrometer.test; | ||
|
||
import javax.inject.Singleton; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
|
||
@Path("/hello") | ||
@Singleton | ||
public class HelloResource { | ||
@GET | ||
@Path("{message}") | ||
public String hello(@PathParam("message") String message) { | ||
return "hello " + message; | ||
} | ||
} |
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
Oops, something went wrong.