@@ -86,7 +86,7 @@ class GatewayBridgeSpecification extends DDSpecification {
86
86
87
87
TraceSegmentPostProcessor pp = Mock ()
88
88
ApiSecuritySamplerImpl requestSampler = Mock (ApiSecuritySamplerImpl )
89
- GatewayBridge bridge = new GatewayBridge (ig, eventDispatcher, requestSampler, [pp])
89
+ GatewayBridge bridge = new GatewayBridge (ig, eventDispatcher, () -> requestSampler, [pp])
90
90
91
91
Supplier<Flow<AppSecRequestContext > > requestStartedCB
92
92
BiFunction<RequestContext , AgentSpan , Flow<Void > > requestEndedCB
@@ -258,8 +258,9 @@ class GatewayBridgeSpecification extends DDSpecification {
258
258
ctx. data. rawURI = ' /'
259
259
ctx. data. peerAddress = ' 0.0.0.0'
260
260
eventDispatcher. getDataSubscribers(_) >> nonEmptyDsInfo
261
- eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >>
262
- { bundle = it[2 ]; NoopFlow . INSTANCE }
261
+ eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >> {
262
+ bundle = it[2 ]; NoopFlow . INSTANCE
263
+ }
263
264
264
265
and :
265
266
reqHeadersDoneCB. apply(ctx)
@@ -277,8 +278,9 @@ class GatewayBridgeSpecification extends DDSpecification {
277
278
278
279
when :
279
280
eventDispatcher. getDataSubscribers(_) >> nonEmptyDsInfo
280
- eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >>
281
- { bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE }
281
+ eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >> {
282
+ bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE
283
+ }
282
284
283
285
and :
284
286
reqHeadersDoneCB. apply(ctx)
@@ -298,8 +300,9 @@ class GatewayBridgeSpecification extends DDSpecification {
298
300
299
301
when :
300
302
eventDispatcher. getDataSubscribers(_) >> nonEmptyDsInfo
301
- eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >>
302
- { bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE }
303
+ eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >> {
304
+ bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE
305
+ }
303
306
304
307
and :
305
308
reqHeadersDoneCB. apply(ctx)
@@ -319,8 +322,9 @@ class GatewayBridgeSpecification extends DDSpecification {
319
322
320
323
when :
321
324
eventDispatcher. getDataSubscribers(_) >> nonEmptyDsInfo
322
- eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >>
323
- { bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE }
325
+ eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >> {
326
+ bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE
327
+ }
324
328
325
329
and :
326
330
reqHeadersDoneCB. apply(ctx)
@@ -339,9 +343,12 @@ class GatewayBridgeSpecification extends DDSpecification {
339
343
def adapter = TestURIDataAdapter . create(uri, supportsRaw)
340
344
341
345
when :
342
- eventDispatcher. getDataSubscribers({ KnownAddresses . REQUEST_URI_RAW in it }) >> nonEmptyDsInfo
343
- eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >>
344
- { bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE }
346
+ eventDispatcher. getDataSubscribers({
347
+ KnownAddresses . REQUEST_URI_RAW in it
348
+ }) >> nonEmptyDsInfo
349
+ eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >> {
350
+ bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE
351
+ }
345
352
346
353
and :
347
354
requestMethodURICB. apply(ctx, ' GET' , adapter)
@@ -373,9 +380,12 @@ class GatewayBridgeSpecification extends DDSpecification {
373
380
def adapter = TestURIDataAdapter . create(uri)
374
381
375
382
when :
376
- eventDispatcher. getDataSubscribers({ KnownAddresses . REQUEST_URI_RAW in it }) >> nonEmptyDsInfo
377
- eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >>
378
- { bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE }
383
+ eventDispatcher. getDataSubscribers({
384
+ KnownAddresses . REQUEST_URI_RAW in it
385
+ }) >> nonEmptyDsInfo
386
+ eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >> {
387
+ bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE
388
+ }
379
389
380
390
and :
381
391
requestMethodURICB. apply(ctx, ' GET' , adapter)
@@ -406,9 +416,12 @@ class GatewayBridgeSpecification extends DDSpecification {
406
416
GatewayContext gatewayContext
407
417
408
418
when :
409
- eventDispatcher. getDataSubscribers({ KnownAddresses . REQUEST_PATH_PARAMS in it }) >> nonEmptyDsInfo
410
- eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >>
411
- { bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE }
419
+ eventDispatcher. getDataSubscribers({
420
+ KnownAddresses . REQUEST_PATH_PARAMS in it
421
+ }) >> nonEmptyDsInfo
422
+ eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >> {
423
+ bundle = it[2 ]; gatewayContext = it[3 ]; NoopFlow . INSTANCE
424
+ }
412
425
413
426
and :
414
427
pathParamsCB. apply(ctx, [a : ' b' ])
@@ -663,9 +676,9 @@ class GatewayBridgeSpecification extends DDSpecification {
663
676
664
677
when :
665
678
Flow<?> flow = requestBodyProcessedCB. apply(ctx, new Object () {
666
- @SuppressWarnings (' UnusedPrivateField' )
667
- private String foo = ' bar'
668
- })
679
+ @SuppressWarnings (' UnusedPrivateField' )
680
+ private String foo = ' bar'
681
+ })
669
682
670
683
then :
671
684
1 * eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >>
@@ -762,9 +775,9 @@ class GatewayBridgeSpecification extends DDSpecification {
762
775
763
776
when :
764
777
Flow<?> flow = grpcServerRequestMessageCB. apply(ctx, new Object () {
765
- @SuppressWarnings (' UnusedPrivateField' )
766
- private String foo = ' bar'
767
- })
778
+ @SuppressWarnings (' UnusedPrivateField' )
779
+ private String foo = ' bar'
780
+ })
768
781
769
782
then :
770
783
1 * eventDispatcher. publishDataEvent(nonEmptyDsInfo, ctx. data, _ as DataBundle , _ as GatewayContext ) >>
@@ -919,28 +932,28 @@ class GatewayBridgeSpecification extends DDSpecification {
919
932
920
933
void ' no appsec events if was not created request context in request_start event' () {
921
934
RequestContext emptyCtx = new RequestContext () {
922
- final Object data = null
923
- BlockResponseFunction blockResponseFunction
924
-
925
- @Override
926
- Object getData (RequestContextSlot slot ) {
927
- data
928
- }
929
-
930
- @Override
931
- final TraceSegment getTraceSegment () {
932
- GatewayBridgeSpecification . this . traceSegment
933
- }
934
-
935
- @Override
936
- def <T> T getOrCreateMetaStructTop (String key , Function<String , T> defaultValue ) {
937
- return null
938
- }
939
-
940
- @Override
941
- void close () throws IOException {}
935
+ final Object data = null
936
+ BlockResponseFunction blockResponseFunction
937
+
938
+ @Override
939
+ Object getData (RequestContextSlot slot ) {
940
+ data
942
941
}
943
942
943
+ @Override
944
+ final TraceSegment getTraceSegment () {
945
+ GatewayBridgeSpecification . this . traceSegment
946
+ }
947
+
948
+ @Override
949
+ def <T> T getOrCreateMetaStructTop (String key , Function<String , T> defaultValue ) {
950
+ return null
951
+ }
952
+
953
+ @Override
954
+ void close () throws IOException {}
955
+ }
956
+
944
957
StoredBodySupplier supplier = Stub ()
945
958
IGSpanInfo spanInfo = Stub (AgentSpan )
946
959
Object obj = ' obj'
0 commit comments