@@ -22,14 +22,14 @@ import XCTest
22
22
final class GRPCServerTests : XCTestCase {
23
23
func withInProcessClientConnectedToServer(
24
24
services: [ any RegistrableRPCService ] ,
25
- interceptors : [ ServerInterceptorTarget ] = [ ] ,
25
+ interceptorPipeline : [ ServerInterceptorOperation ] = [ ] ,
26
26
_ body: ( InProcessTransport . Client , GRPCServer ) async throws -> Void
27
27
) async throws {
28
28
let inProcess = InProcessTransport ( )
29
29
let server = GRPCServer (
30
30
transport: inProcess. server,
31
31
services: services,
32
- interceptors : interceptors
32
+ interceptorPipeline : interceptorPipeline
33
33
)
34
34
35
35
try await withThrowingTaskGroup ( of: Void . self) { group in
@@ -220,10 +220,10 @@ final class GRPCServerTests: XCTestCase {
220
220
221
221
try await self . withInProcessClientConnectedToServer (
222
222
services: [ BinaryEcho ( ) ] ,
223
- interceptors : [
224
- . allServices ( interceptor : . requestCounter( counter1) ) ,
225
- . allServices ( interceptor : . rejectAll( with: RPCError ( code: . unavailable, message: " " ) ) ) ,
226
- . allServices ( interceptor : . requestCounter( counter2) ) ,
223
+ interceptorPipeline : [
224
+ . applyToAllServices ( . requestCounter( counter1) ) ,
225
+ . applyToAllServices ( . rejectAll( with: RPCError ( code: . unavailable, message: " " ) ) ) ,
226
+ . applyToAllServices ( . requestCounter( counter2) ) ,
227
227
]
228
228
) { client, _ in
229
229
try await client. withStream (
@@ -249,7 +249,7 @@ final class GRPCServerTests: XCTestCase {
249
249
250
250
try await self . withInProcessClientConnectedToServer (
251
251
services: [ BinaryEcho ( ) ] ,
252
- interceptors : [ . allServices ( interceptor : . requestCounter( counter) ) ]
252
+ interceptorPipeline : [ . applyToAllServices ( . requestCounter( counter) ) ]
253
253
) { client, _ in
254
254
try await client. withStream (
255
255
descriptor: MethodDescriptor ( service: " not " , method: " implemented " ) ,
@@ -387,19 +387,19 @@ struct ServerTests {
387
387
388
388
try await self . withInProcessClientConnectedToServer (
389
389
services: [ BinaryEcho ( ) , HelloWorld ( ) ] ,
390
- interceptors : [
391
- . serviceSpecific (
392
- interceptor : . requestCounter( onlyBinaryEchoCounter) ,
393
- services : [ BinaryEcho . serviceName]
390
+ interceptorPipeline : [
391
+ . apply (
392
+ . requestCounter( onlyBinaryEchoCounter) ,
393
+ onlyToServices : [ BinaryEcho . serviceName]
394
394
) ,
395
- . allServices ( interceptor : . requestCounter( allServicesCounter) ) ,
396
- . serviceSpecific (
397
- interceptor : . requestCounter( onlyHelloWorldCounter) ,
398
- services : [ HelloWorld . serviceName]
395
+ . applyToAllServices ( . requestCounter( allServicesCounter) ) ,
396
+ . apply (
397
+ . requestCounter( onlyHelloWorldCounter) ,
398
+ onlyToServices : [ HelloWorld . serviceName]
399
399
) ,
400
- . serviceSpecific (
401
- interceptor : . requestCounter( bothServicesCounter) ,
402
- services : [ BinaryEcho . serviceName, HelloWorld . serviceName]
400
+ . apply (
401
+ . requestCounter( bothServicesCounter) ,
402
+ onlyToServices : [ BinaryEcho . serviceName, HelloWorld . serviceName]
403
403
) ,
404
404
]
405
405
) { client, _ in
@@ -474,19 +474,19 @@ struct ServerTests {
474
474
475
475
try await self . withInProcessClientConnectedToServer (
476
476
services: [ BinaryEcho ( ) ] ,
477
- interceptors : [
478
- . methodSpecific (
479
- interceptor : . requestCounter( onlyBinaryEchoGetCounter) ,
480
- methods : [ BinaryEcho . Methods. get]
477
+ interceptorPipeline : [
478
+ . apply (
479
+ . requestCounter( onlyBinaryEchoGetCounter) ,
480
+ onlyToMethods : [ BinaryEcho . Methods. get]
481
481
) ,
482
- . allServices ( interceptor : . requestCounter( allMethodsCounter) ) ,
483
- . methodSpecific (
484
- interceptor : . requestCounter( onlyBinaryEchoCollectCounter) ,
485
- methods : [ BinaryEcho . Methods. collect]
482
+ . applyToAllServices ( . requestCounter( allMethodsCounter) ) ,
483
+ . apply (
484
+ . requestCounter( onlyBinaryEchoCollectCounter) ,
485
+ onlyToMethods : [ BinaryEcho . Methods. collect]
486
486
) ,
487
- . methodSpecific (
488
- interceptor : . requestCounter( bothBinaryEchoMethodsCounter) ,
489
- methods : [ BinaryEcho . Methods. get, BinaryEcho . Methods. collect]
487
+ . apply (
488
+ . requestCounter( bothBinaryEchoMethodsCounter) ,
489
+ onlyToMethods : [ BinaryEcho . Methods. get, BinaryEcho . Methods. collect]
490
490
) ,
491
491
]
492
492
) { client, _ in
@@ -554,14 +554,14 @@ struct ServerTests {
554
554
555
555
func withInProcessClientConnectedToServer(
556
556
services: [ any RegistrableRPCService ] ,
557
- interceptors : [ ServerInterceptorTarget ] = [ ] ,
557
+ interceptorPipeline : [ ServerInterceptorOperation ] = [ ] ,
558
558
_ body: ( InProcessTransport . Client , GRPCServer ) async throws -> Void
559
559
) async throws {
560
560
let inProcess = InProcessTransport ( )
561
561
let server = GRPCServer (
562
562
transport: inProcess. server,
563
563
services: services,
564
- interceptors : interceptors
564
+ interceptorPipeline : interceptorPipeline
565
565
)
566
566
567
567
try await withThrowingTaskGroup ( of: Void . self) { group in
0 commit comments