6
6
import com .datadog .appsec .config .AppSecConfig ;
7
7
import com .datadog .appsec .config .AppSecConfigDeserializer ;
8
8
import com .datadog .appsec .event .data .KnownAddresses ;
9
- import io . sqreen . powerwaf . Additive ;
10
- import io . sqreen . powerwaf . Powerwaf ;
11
- import io . sqreen . powerwaf . PowerwafContext ;
12
- import io . sqreen . powerwaf . PowerwafMetrics ;
13
- import io . sqreen . powerwaf .exception .AbstractPowerwafException ;
9
+ import com . datadog . ddwaf . Waf ;
10
+ import com . datadog . ddwaf . WafContext ;
11
+ import com . datadog . ddwaf . WafHandle ;
12
+ import com . datadog . ddwaf . WafMetrics ;
13
+ import com . datadog . ddwaf .exception .AbstractWafException ;
14
14
import java .io .IOException ;
15
15
import java .io .InputStream ;
16
16
import java .util .ArrayList ;
37
37
@ BenchmarkMode (Mode .AverageTime )
38
38
@ OutputTimeUnit (MICROSECONDS )
39
39
@ Fork (value = 3 )
40
- public class PowerwafBenchmark {
40
+ public class WafBenchmark {
41
41
42
42
static {
43
43
BenchmarkUtil .disableLogging ();
44
- BenchmarkUtil .initializePowerwaf ();
44
+ BenchmarkUtil .initializeWaf ();
45
45
}
46
46
47
- PowerwafContext ctx ;
47
+ WafHandle ctx ;
48
48
Map <String , Object > wafData = new HashMap <>();
49
- Powerwaf .Limits limits = new Powerwaf .Limits (50 , 500 , 1000 , 5000000 , 5000000 );
49
+ Waf .Limits limits = new Waf .Limits (50 , 500 , 1000 , 5000000 , 5000000 );
50
50
51
51
@ Benchmark
52
52
public void withMetrics () throws Exception {
53
- PowerwafMetrics metricsCollector = ctx .createMetrics ();
54
- Additive add = ctx .openAdditive ();
53
+ WafMetrics metricsCollector = ctx .createMetrics ();
54
+ WafContext add = ctx .openContext ();
55
55
try {
56
56
add .run (wafData , limits , metricsCollector );
57
57
} finally {
@@ -61,7 +61,7 @@ public void withMetrics() throws Exception {
61
61
62
62
@ Benchmark
63
63
public void withoutMetrics () throws Exception {
64
- Additive add = ctx .openAdditive ();
64
+ WafContext add = ctx .openContext ();
65
65
try {
66
66
add .run (wafData , limits , null );
67
67
} finally {
@@ -70,12 +70,12 @@ public void withoutMetrics() throws Exception {
70
70
}
71
71
72
72
@ Setup (Level .Trial )
73
- public void setUp () throws AbstractPowerwafException , IOException {
73
+ public void setUp () throws AbstractWafException , IOException {
74
74
InputStream stream = getClass ().getClassLoader ().getResourceAsStream ("test_multi_config.json" );
75
75
Map <String , AppSecConfig > cfg =
76
76
Collections .singletonMap ("waf" , AppSecConfigDeserializer .INSTANCE .deserialize (stream ));
77
77
AppSecConfig waf = cfg .get ("waf" );
78
- ctx = Powerwaf . createContext ("waf" , waf .getRawConfig ());
78
+ ctx = Waf . createHandle ("waf" , waf .getRawConfig ());
79
79
80
80
wafData .put (KnownAddresses .REQUEST_METHOD .getKey (), "POST" );
81
81
wafData .put (
0 commit comments