2
2
3
3
import com .google .inject .Module ;
4
4
import com .google .inject .util .Modules ;
5
+ import ratpack .exec .Promise ;
5
6
import ratpack .guice .Guice ;
6
- import ratpack .http .Status ;
7
7
import ratpack .test .embed .EmbeddedApp ;
8
8
import ratpack .zipkin .ServerTracingModule ;
9
9
10
+ import java .io .IOException ;
10
11
import java .net .URI ;
11
12
12
13
public class ITServerTracingModule extends ITHttpServer {
@@ -21,14 +22,23 @@ protected void init() throws Exception {
21
22
server .registry (Guice .registry (binding -> binding .module (tracingModule )))
22
23
.handlers (chain -> chain
23
24
.get ("/foo" , ctx -> ctx .getResponse ().send ("bar" ))
25
+ .get ("/async" , ctx ->
26
+ Promise .async (f -> f .success ("bar" )).then (ctx ::render )
27
+ )
24
28
.get ("/badrequest" , ctx -> ctx .getResponse ().status (400 ).send ())
25
29
.get ("/child" , ctx -> {
26
30
HttpTracing httpTracing = ctx .get (HttpTracing .class );
27
31
httpTracing .tracing ().tracer ().nextSpan ().name ("child" ).start ().finish ();
28
32
ctx .getResponse ().send ("happy" );
29
33
})
30
34
.get ("/extra" , ctx -> ctx .getResponse ().send ("joey" ))
31
- .all (ctx -> ctx .getResponse ().status (500 ).send ()))
35
+ .get ("/exception" , ctx -> {
36
+ throw new IOException ();
37
+ })
38
+ .get ("/exceptionAsync" ,
39
+ ctx -> Promise .async ((f ) -> f .error (new IOException ())).then (ctx ::render )
40
+ )
41
+ .all (ctx -> ctx .getResponse ().status (404 ).send ()))
32
42
);
33
43
}
34
44
0 commit comments