Skip to content

Generic Quarkus Application Tips

Debug Quarkus App with Intellij

Step 1 Start Quarkus and extract the Debug Port

  • In our sample its port 5005
$ mvn compile quarkus:dev
..
[INFO] Nothing to compile - all classes are up to date
Listening for transport dt_socket at address: 5005
..

Attach the Debugger to the JAVA Quarkus Process

  • Run -> Attach Process -> Select your JAVA process ( should show port 5005 )
  • Set a breakpoint and start debugging

Reference


Enable Test Output for Quarkus to show debug messages

When starting Quarkus with debug messages from Logger and or System.out are not shown.

Just press o to enable the Test Output


JUnit 5 Test Execution Order

@QuarkusTest
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class PolicyEnforcerTest {
    static {
        RestAssured.useRelaxedHTTPSValidation();
    }
...
   @Test
   @Order(1)
   public void testAdminCanCreateUser() {
        if (testUser901ID == null) {
            getAccountsResource();
        }
        String requestBody = "{\n" +
                "  \"username\": \"Helmut901\"\n" +"\n}";

        RestAssured.given().auth().oauth2(getAccessToken("testadmin" ,"xxx"))
                .header("Content-type", "application/json")
                .and()
                .body(requestBody)
                .when().post("/account")
                .then()
                .statusCode(200)
                .body("kc_status", is("OK"));
    }

    @Test
    @Order(2)
    public void testAdminCanViewUser() {
        if (testUser901ID == null) {
            getAccountsResource();
        }
        assertThat("Could not find user testuser  ID - verify your Keycloak Setup!", testUser901ID, is(notNullValue()));
        RestAssured.given().auth().oauth2(getAccessToken("testadmin" ,"xxx"))
                .when().get("/account/" + testUser901ID)
                .then()
                .statusCode(200)
                .body("kc_status", is("OK"));
    }

Reference

Published inQuarkus

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *