Skip to content

Commit ed4787b

Browse files
Merge pull request #49106 from phillip-kruger/dev-ui-vertx-test
Moved relevant vertx-http tests back to vertx-http from Dev UI
2 parents b575b36 + 34d13c1 commit ed4787b

File tree

70 files changed

+393
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+393
-14
lines changed

extensions/devui/deployment/src/test/java/io/quarkus/vertx/http/devui/DevUICorsTest.java renamed to extensions/devui/deployment/src/test/java/io/quarkus/devui/DevUICorsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.quarkus.vertx.http.devui;
1+
package io.quarkus.devui;
22

33
import static org.hamcrest.Matchers.emptyOrNullString;
44
import static org.hamcrest.Matchers.not;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.quarkus.vertx.http.devui;
1+
package io.quarkus.devui;
22

33
import static org.hamcrest.MatcherAssert.assertThat;
44
import static org.hamcrest.Matchers.*;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.quarkus.vertx.http.devui;
1+
package io.quarkus.devui;
22

33
import static org.hamcrest.Matchers.emptyOrNullString;
44

extensions/devui/deployment/src/test/java/io/quarkus/vertx/http/devmcp/DevMcpTest.java renamed to extensions/devui/deployment/src/test/java/io/quarkus/devui/devmcp/DevMcpTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.quarkus.vertx.http.devmcp;
1+
package io.quarkus.devui.devmcp;
22

33
import java.util.function.Supplier;
44

@@ -9,8 +9,8 @@
99
import org.junit.jupiter.api.Test;
1010
import org.junit.jupiter.api.extension.RegisterExtension;
1111

12+
import io.quarkus.devui.testrunner.HelloResource;
1213
import io.quarkus.test.QuarkusDevModeTest;
13-
import io.quarkus.vertx.http.testrunner.HelloResource;
1414
import io.restassured.RestAssured;
1515
import io.restassured.http.ContentType;
1616

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.quarkus.devui.testrunner;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
6+
public class CoupledET {
7+
8+
@Test
9+
public void unitStyleTest2() {
10+
Assertions.assertEquals("unit", CoupledService.service());
11+
}
12+
13+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package io.quarkus.devui.testrunner;
2+
3+
public class CoupledService {
4+
5+
public static String service() {
6+
return "unit";
7+
}
8+
9+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package io.quarkus.devui.testrunner;
2+
3+
import static io.restassured.RestAssured.given;
4+
import static org.hamcrest.CoreMatchers.is;
5+
6+
import java.util.UUID;
7+
8+
import org.junit.jupiter.api.Test;
9+
10+
import io.quarkus.test.junit.QuarkusTest;
11+
12+
@QuarkusTest
13+
public class DuplicateSimpleET {
14+
15+
@Test
16+
public void testHelloEndpoint() {
17+
given()
18+
.when().get("/hello")
19+
.then()
20+
.statusCode(200)
21+
.body(is("hello"));
22+
}
23+
24+
@Test
25+
public void testGreetingEndpoint() {
26+
String uuid = UUID.randomUUID().toString();
27+
given()
28+
.pathParam("name", uuid)
29+
.when().get("/hello/greeting/{name}")
30+
.then()
31+
.statusCode(200)
32+
.body(is("hello " + uuid));
33+
}
34+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package io.quarkus.devui.testrunner;
2+
3+
import jakarta.enterprise.context.ApplicationScoped;
4+
import jakarta.enterprise.event.Observes;
5+
6+
import io.vertx.core.Handler;
7+
import io.vertx.ext.web.Router;
8+
import io.vertx.ext.web.RoutingContext;
9+
10+
@ApplicationScoped
11+
public class HelloResource {
12+
13+
public void route(@Observes Router router) {
14+
router.route("/hello/greeting/:name").handler(new Handler<RoutingContext>() {
15+
@Override
16+
public void handle(RoutingContext event) {
17+
event.response().end("hello " + event.pathParam("name"));
18+
}
19+
});
20+
//setup(router);
21+
}
22+
23+
void setup(Router router) {
24+
router.route("/hello").handler(new Handler<RoutingContext>() {
25+
@Override
26+
public void handle(RoutingContext routingContext) {
27+
routingContext.response().end(sayHello());
28+
}
29+
});
30+
}
31+
32+
public String sayHello() {
33+
return "hello";
34+
}
35+
36+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package io.quarkus.devui.testrunner;
2+
3+
import static io.restassured.RestAssured.given;
4+
import static org.hamcrest.CoreMatchers.is;
5+
6+
import java.util.UUID;
7+
8+
import org.junit.jupiter.api.Test;
9+
10+
import io.quarkus.test.junit.QuarkusTest;
11+
12+
@QuarkusTest
13+
public class SimpleET {
14+
15+
@Test
16+
public void testHelloEndpoint() {
17+
given()
18+
.when().get("/hello")
19+
.then()
20+
.statusCode(200)
21+
.body(is("hello"));
22+
}
23+
24+
@Test
25+
public void testGreetingEndpoint() {
26+
String uuid = UUID.randomUUID().toString();
27+
given()
28+
.pathParam("name", uuid)
29+
.when().get("/hello/greeting/{name}")
30+
.then()
31+
.statusCode(200)
32+
.body(is("hello " + uuid));
33+
}
34+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.quarkus.devui.testrunner;
2+
3+
import jakarta.enterprise.context.ApplicationScoped;
4+
import jakarta.enterprise.event.Observes;
5+
6+
import io.quarkus.runtime.LaunchMode;
7+
import io.vertx.ext.web.Router;
8+
9+
@ApplicationScoped
10+
public class StartupFailer {
11+
12+
public void route(@Observes Router router) {
13+
//fail();
14+
}
15+
16+
void fail() {
17+
if (LaunchMode.current() == LaunchMode.TEST) {
18+
throw new RuntimeException("FAIL");
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)