@@ -22,14 +22,14 @@ import XCTest
2222final class GRPCServerTests : XCTestCase {
2323 func withInProcessClientConnectedToServer(
2424 services: [ any RegistrableRPCService ] ,
25- interceptors : [ ServerInterceptorTarget ] = [ ] ,
25+ interceptorPipeline : [ ServerInterceptorOperation ] = [ ] ,
2626 _ body: ( InProcessTransport . Client , GRPCServer ) async throws -> Void
2727 ) async throws {
2828 let inProcess = InProcessTransport ( )
2929 let server = GRPCServer (
3030 transport: inProcess. server,
3131 services: services,
32- interceptors : interceptors
32+ interceptorPipeline : interceptorPipeline
3333 )
3434
3535 try await withThrowingTaskGroup ( of: Void . self) { group in
@@ -220,10 +220,10 @@ final class GRPCServerTests: XCTestCase {
220220
221221 try await self . withInProcessClientConnectedToServer (
222222 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) ) ,
227227 ]
228228 ) { client, _ in
229229 try await client. withStream (
@@ -249,7 +249,7 @@ final class GRPCServerTests: XCTestCase {
249249
250250 try await self . withInProcessClientConnectedToServer (
251251 services: [ BinaryEcho ( ) ] ,
252- interceptors : [ . allServices ( interceptor : . requestCounter( counter) ) ]
252+ interceptorPipeline : [ . applyToAllServices ( . requestCounter( counter) ) ]
253253 ) { client, _ in
254254 try await client. withStream (
255255 descriptor: MethodDescriptor ( service: " not " , method: " implemented " ) ,
@@ -387,19 +387,19 @@ struct ServerTests {
387387
388388 try await self . withInProcessClientConnectedToServer (
389389 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]
394394 ) ,
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]
399399 ) ,
400- . serviceSpecific (
401- interceptor : . requestCounter( bothServicesCounter) ,
402- services : [ BinaryEcho . serviceName, HelloWorld . serviceName]
400+ . apply (
401+ . requestCounter( bothServicesCounter) ,
402+ onlyToServices : [ BinaryEcho . serviceName, HelloWorld . serviceName]
403403 ) ,
404404 ]
405405 ) { client, _ in
@@ -474,19 +474,19 @@ struct ServerTests {
474474
475475 try await self . withInProcessClientConnectedToServer (
476476 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]
481481 ) ,
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]
486486 ) ,
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]
490490 ) ,
491491 ]
492492 ) { client, _ in
@@ -554,14 +554,14 @@ struct ServerTests {
554554
555555 func withInProcessClientConnectedToServer(
556556 services: [ any RegistrableRPCService ] ,
557- interceptors : [ ServerInterceptorTarget ] = [ ] ,
557+ interceptorPipeline : [ ServerInterceptorOperation ] = [ ] ,
558558 _ body: ( InProcessTransport . Client , GRPCServer ) async throws -> Void
559559 ) async throws {
560560 let inProcess = InProcessTransport ( )
561561 let server = GRPCServer (
562562 transport: inProcess. server,
563563 services: services,
564- interceptors : interceptors
564+ interceptorPipeline : interceptorPipeline
565565 )
566566
567567 try await withThrowingTaskGroup ( of: Void . self) { group in
0 commit comments