1
2
3
4
5
6
7 package waffle.servlet;
8
9 import jakarta.servlet.ServletException;
10
11 import java.io.IOException;
12
13 import org.junit.jupiter.api.Assertions;
14 import org.junit.jupiter.api.Test;
15 import org.openjdk.jmh.annotations.Benchmark;
16 import org.openjdk.jmh.annotations.Level;
17 import org.openjdk.jmh.annotations.Scope;
18 import org.openjdk.jmh.annotations.Setup;
19 import org.openjdk.jmh.annotations.State;
20 import org.openjdk.jmh.annotations.TearDown;
21 import org.openjdk.jmh.runner.Runner;
22 import org.openjdk.jmh.runner.RunnerException;
23 import org.openjdk.jmh.runner.options.Options;
24 import org.openjdk.jmh.runner.options.OptionsBuilder;
25
26
27
28
29 class NegotiateSecurityFilterLoadTest {
30
31
32
33
34
35
36
37 @Test
38 void launchLoadTest() throws RunnerException {
39 final Options opt = new OptionsBuilder().threads(10).measurementIterations(10).build();
40 Assertions.assertNotNull(new Runner(opt).run());
41 }
42
43
44
45
46 @State(Scope.Thread)
47 public static class St {
48
49
50 private final NegotiateSecurityFilterTest tests = new NegotiateSecurityFilterTest();
51
52
53
54
55
56
57
58 @Setup(Level.Trial)
59 public void initialize() throws ServletException {
60 this.tests.setUp();
61 }
62
63
64
65
66
67
68
69
70
71 @Benchmark
72 public void benchmark() throws IOException, ServletException {
73 this.tests.testNegotiate();
74 }
75
76
77
78
79 @TearDown(Level.Trial)
80 public void cleanup() {
81 this.tests.tearDown();
82 }
83
84 }
85
86 }