forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade SmallRye Health to 3.3.1 (4.0.1)
- Loading branch information
Showing
6 changed files
with
78 additions
and
2 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
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
51 changes: 51 additions & 0 deletions
51
...alth/deployment/src/test/java/io/quarkus/smallrye/health/test/DefaultHealthGroupTest.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,51 @@ | ||
package io.quarkus.smallrye.health.test; | ||
|
||
import static org.hamcrest.Matchers.contains; | ||
import static org.hamcrest.Matchers.hasItems; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.smallrye.health.test.ui.HealthGroupCheck; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
import io.restassured.parsing.Parser; | ||
|
||
public class DefaultHealthGroupTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(BasicHealthCheck.class, HealthGroupCheck.class) | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")) | ||
.overrideConfigKey("quarkus.smallrye-health.default-health-group", "my-default-health-group"); | ||
|
||
@Test | ||
public void testDefaultHealthGroup() { | ||
try { | ||
RestAssured.defaultParser = Parser.JSON; | ||
RestAssured.when().get("/q/health/group/my-default-health-group").then() | ||
.body("status", is("UP"), | ||
"checks.size()", is(1), | ||
"checks.status", contains("UP"), | ||
"checks.name", contains("basic")); | ||
|
||
RestAssured.when().get("/q/health/group/test-group").then() | ||
.body("status", is("UP"), | ||
"checks.size()", is(1), | ||
"checks.status", contains("UP"), | ||
"checks.name", contains(HealthGroupCheck.class.getName())); | ||
|
||
RestAssured.when().get("/q/health/group").then() | ||
.body("status", is("UP"), | ||
"checks.size()", is(2), | ||
"checks.status", hasItems("UP", "UP"), | ||
"checks.name", hasItems("basic", HealthGroupCheck.class.getName())); | ||
} finally { | ||
RestAssured.reset(); | ||
} | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...-health/deployment/src/test/java/io/quarkus/smallrye/health/test/ui/HealthGroupCheck.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,14 @@ | ||
package io.quarkus.smallrye.health.test.ui; | ||
|
||
import org.eclipse.microprofile.health.HealthCheck; | ||
import org.eclipse.microprofile.health.HealthCheckResponse; | ||
|
||
import io.smallrye.health.api.HealthGroup; | ||
|
||
@HealthGroup("test-group") | ||
public class HealthGroupCheck implements HealthCheck { | ||
@Override | ||
public HealthCheckResponse call() { | ||
return HealthCheckResponse.up(HealthGroupCheck.class.getName()); | ||
} | ||
} |
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