Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add Hello World and Todo MVC Quarkus Example [#3549] #4366

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions example/javalib/web/6-hello-quarkus/build.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package build
import mill._, javalib._

object `package` extends RootModule with JavaModule {
def ivyDeps = Agg(
ivy"io.quarkus:quarkus-core:3.17.7",
ivy"io.quarkus:quarkus-resteasy:3.17.7",
ivy"io.quarkus:quarkus-arc:3.17.7",
ivy"io.quarkus:quarkus-rest:3.17.7"
)

object test extends JavaTests with TestModule.Junit5 {
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"io.quarkus:quarkus-junit5:3.17.7",
ivy"io.rest-assured:rest-assured:5.5.0"
)
}
}

// This example demonstrates how to set up a simple Quarkus webserver,
// able to handle a single HTTP request at `/` and reply with a single response.

/** Usage

> ./mill compile quarkus dev

> ./mill test

> mill runBackground

> curl http://localhost:8050
...Hello, Quarkus!...

> mill clean runBackground

*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Application configuration file
quarkus.http.port=8050
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.example;

import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

@Path("/hello")
public class HelloQuarkus {

@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "Hello, Quarkus!";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.example;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;

@QuarkusTest
class HelloQuarkusTest {
@Test
void testHelloEndpoint() {
given().when().get("/hello").then().statusCode(200).body(is("Hello, Quarkus!"));
}
}