File tree Expand file tree Collapse file tree 6 files changed +61
-82
lines changed
proxy-wasm-jaxrs/src/test/java/io/roastedroot/proxywasm/jaxrs Expand file tree Collapse file tree 6 files changed +61
-82
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ package io .roastedroot .proxywasm .jaxrs ;
2+
3+ import jakarta .ws .rs .GET ;
4+ import jakarta .ws .rs .Path ;
5+
6+ @ Path ("/http_headers" )
7+ public class HttpHeadersResource {
8+
9+ @ GET
10+ @ NamedWasmPlugin ("http_headers" )
11+ public String get () {
12+ return "hello world" ;
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ package io .roastedroot .proxywasm .jaxrs ;
2+
3+ import static io .restassured .RestAssured .given ;
4+ import static io .roastedroot .proxywasm .jaxrs .TestHelpers .EXAMPLES_DIR ;
5+ import static org .hamcrest .Matchers .equalTo ;
6+
7+ import com .dylibso .chicory .wasm .Parser ;
8+ import io .quarkus .test .junit .QuarkusTest ;
9+ import io .roastedroot .proxywasm .StartException ;
10+ import jakarta .enterprise .inject .Produces ;
11+ import java .nio .file .Path ;
12+ import org .junit .jupiter .api .Test ;
13+
14+ @ QuarkusTest
15+ public class HttpHeadersTest {
16+
17+ @ Produces
18+ public WasmPluginFactory create () throws StartException {
19+ return () ->
20+ WasmPlugin .builder ()
21+ .withName ("http_headers" )
22+ .withPluginConfig ("{\" header\" : \" x-wasm-header\" , \" value\" : \" foo\" }" )
23+ .build (
24+ Parser .parse (
25+ Path .of (
26+ EXAMPLES_DIR
27+ + "/go-examples/http_headers/main.wasm" )));
28+ }
29+
30+ @ Test
31+ public void testRequest () {
32+ given ().when ()
33+ .get ("/http_headers" )
34+ .then ()
35+ .statusCode (200 )
36+ .header ("x-proxy-wasm-go-sdk-example" , "http_headers" )
37+ .header ("x-wasm-header" , "foo" )
38+ .body (equalTo ("hello world" ));
39+ }
40+ }
Original file line number Diff line number Diff line change 1+ package io .roastedroot .proxywasm .jaxrs ;
2+
3+ public final class TestHelpers {
4+ private TestHelpers () {}
5+
6+ public static final String EXAMPLES_DIR = "../proxy-wasm-java-host/src/test" ;
7+ }
You can’t perform that action at this time.
0 commit comments