Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ abstract class Fs2AbstractServicePrinter extends Fs2ServicePrinter {

private[this] val serviceName: String = service.name
private[this] val serviceNameFs2: String = s"$serviceName${serviceSuffix}"
private[this] val servicePkgName: String = service.getFile.scalaPackage.fullName
private[this] val servicePkgName: String = service.getFile.scalaPackage.fullName.stripPrefix("_root_.")

protected def serviceMethodSignature(method: MethodDescriptor): String

Expand Down
76 changes: 38 additions & 38 deletions e2e/src/test/resources/TestServiceFs2Grpc.scala.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,51 @@ import _root_.cats.syntax.all._
trait TestServiceFs2Grpc[F[_], A] {
/** Unary RPC: no streaming in either direction
*/
def noStreaming(request: hello.world.TestMessage, ctx: A): F[hello.world.TestMessage]
def noStreaming(request: _root_.hello.world.TestMessage, ctx: A): F[_root_.hello.world.TestMessage]
/** Client streaming RPC: client streams, server returns a single response
*/
def clientStreaming(request: _root_.fs2.Stream[F, hello.world.TestMessage], ctx: A): F[hello.world.TestMessage]
def clientStreaming(request: _root_.fs2.Stream[F, _root_.hello.world.TestMessage], ctx: A): F[_root_.hello.world.TestMessage]
/** Server streaming RPC: client sends one request, server streams responses
*/
def serverStreaming(request: hello.world.TestMessage, ctx: A): _root_.fs2.Stream[F, hello.world.TestMessage]
def serverStreaming(request: _root_.hello.world.TestMessage, ctx: A): _root_.fs2.Stream[F, _root_.hello.world.TestMessage]
/** Bidirectional streaming RPC: both client and server stream
*/
def bothStreaming(request: _root_.fs2.Stream[F, hello.world.TestMessage], ctx: A): _root_.fs2.Stream[F, hello.world.TestMessage]
def bothStreaming(request: _root_.fs2.Stream[F, _root_.hello.world.TestMessage], ctx: A): _root_.fs2.Stream[F, _root_.hello.world.TestMessage]
}

object TestServiceFs2Grpc extends _root_.fs2.grpc.GeneratedCompanion[TestServiceFs2Grpc] {

def serviceDescriptor: _root_.io.grpc.ServiceDescriptor = hello.world.TestServiceGrpc.SERVICE
def serviceDescriptor: _root_.io.grpc.ServiceDescriptor = _root_.hello.world.TestServiceGrpc.SERVICE

def mkClientFull[F[_], G[_]: _root_.cats.effect.Async, A](
dispatcher: _root_.cats.effect.std.Dispatcher[G],
channel: _root_.io.grpc.Channel,
clientAspect: _root_.fs2.grpc.client.ClientAspect[F, G, A],
clientOptions: _root_.fs2.grpc.client.ClientOptions
): TestServiceFs2Grpc[F, A] = new TestServiceFs2Grpc[F, A] {
def noStreaming(request: hello.world.TestMessage, ctx: A): F[hello.world.TestMessage] =
clientAspect.visitUnaryToUnaryCall[hello.world.TestMessage, hello.world.TestMessage](
_root_.fs2.grpc.client.ClientCallContext(ctx, hello.world.TestServiceGrpc.METHOD_NO_STREAMING),
def noStreaming(request: _root_.hello.world.TestMessage, ctx: A): F[_root_.hello.world.TestMessage] =
clientAspect.visitUnaryToUnaryCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage](
_root_.fs2.grpc.client.ClientCallContext(ctx, _root_.hello.world.TestServiceGrpc.METHOD_NO_STREAMING),
request,
(req, m) => _root_.fs2.grpc.client.Fs2ClientCall[G](channel, hello.world.TestServiceGrpc.METHOD_NO_STREAMING, dispatcher, clientOptions).flatMap(_.unaryToUnaryCall(req, m))
(req, m) => _root_.fs2.grpc.client.Fs2ClientCall[G](channel, _root_.hello.world.TestServiceGrpc.METHOD_NO_STREAMING, dispatcher, clientOptions).flatMap(_.unaryToUnaryCall(req, m))
)
def clientStreaming(request: _root_.fs2.Stream[F, hello.world.TestMessage], ctx: A): F[hello.world.TestMessage] =
clientAspect.visitStreamingToUnaryCall[hello.world.TestMessage, hello.world.TestMessage](
_root_.fs2.grpc.client.ClientCallContext(ctx, hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING),
def clientStreaming(request: _root_.fs2.Stream[F, _root_.hello.world.TestMessage], ctx: A): F[_root_.hello.world.TestMessage] =
clientAspect.visitStreamingToUnaryCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage](
_root_.fs2.grpc.client.ClientCallContext(ctx, _root_.hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING),
request,
(req, m) => _root_.fs2.grpc.client.Fs2ClientCall[G](channel, hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING, dispatcher, clientOptions).flatMap(_.streamingToUnaryCall(req, m))
(req, m) => _root_.fs2.grpc.client.Fs2ClientCall[G](channel, _root_.hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING, dispatcher, clientOptions).flatMap(_.streamingToUnaryCall(req, m))
)
def serverStreaming(request: hello.world.TestMessage, ctx: A): _root_.fs2.Stream[F, hello.world.TestMessage] =
clientAspect.visitUnaryToStreamingCall[hello.world.TestMessage, hello.world.TestMessage](
_root_.fs2.grpc.client.ClientCallContext(ctx, hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING),
def serverStreaming(request: _root_.hello.world.TestMessage, ctx: A): _root_.fs2.Stream[F, _root_.hello.world.TestMessage] =
clientAspect.visitUnaryToStreamingCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage](
_root_.fs2.grpc.client.ClientCallContext(ctx, _root_.hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING),
request,
(req, m) => _root_.fs2.Stream.eval(_root_.fs2.grpc.client.Fs2ClientCall[G](channel, hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING, dispatcher, clientOptions)).flatMap(_.unaryToStreamingCall(req, m))
(req, m) => _root_.fs2.Stream.eval(_root_.fs2.grpc.client.Fs2ClientCall[G](channel, _root_.hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING, dispatcher, clientOptions)).flatMap(_.unaryToStreamingCall(req, m))
)
def bothStreaming(request: _root_.fs2.Stream[F, hello.world.TestMessage], ctx: A): _root_.fs2.Stream[F, hello.world.TestMessage] =
clientAspect.visitStreamingToStreamingCall[hello.world.TestMessage, hello.world.TestMessage](
_root_.fs2.grpc.client.ClientCallContext(ctx, hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING),
def bothStreaming(request: _root_.fs2.Stream[F, _root_.hello.world.TestMessage], ctx: A): _root_.fs2.Stream[F, _root_.hello.world.TestMessage] =
clientAspect.visitStreamingToStreamingCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage](
_root_.fs2.grpc.client.ClientCallContext(ctx, _root_.hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING),
request,
(req, m) => _root_.fs2.Stream.eval(_root_.fs2.grpc.client.Fs2ClientCall[G](channel, hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING, dispatcher, clientOptions)).flatMap(_.streamingToStreamingCall(req, m))
(req, m) => _root_.fs2.Stream.eval(_root_.fs2.grpc.client.Fs2ClientCall[G](channel, _root_.hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING, dispatcher, clientOptions)).flatMap(_.streamingToStreamingCall(req, m))
)
}

Expand All @@ -63,42 +63,42 @@ object TestServiceFs2Grpc extends _root_.fs2.grpc.GeneratedCompanion[TestService
serverOptions: _root_.fs2.grpc.server.ServerOptions
) = {
_root_.io.grpc.ServerServiceDefinition
.builder(hello.world.TestServiceGrpc.SERVICE)
.builder(_root_.hello.world.TestServiceGrpc.SERVICE)
.addMethod(
hello.world.TestServiceGrpc.METHOD_NO_STREAMING,
_root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).unaryToUnaryCall[hello.world.TestMessage, hello.world.TestMessage]{ (r, m) =>
serviceAspect.visitUnaryToUnaryCall[hello.world.TestMessage, hello.world.TestMessage](
_root_.fs2.grpc.server.ServiceCallContext(m, hello.world.TestServiceGrpc.METHOD_NO_STREAMING),
_root_.hello.world.TestServiceGrpc.METHOD_NO_STREAMING,
_root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).unaryToUnaryCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage]{ (r, m) =>
serviceAspect.visitUnaryToUnaryCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage](
_root_.fs2.grpc.server.ServiceCallContext(m, _root_.hello.world.TestServiceGrpc.METHOD_NO_STREAMING),
r,
(r, m) => serviceImpl.noStreaming(r, m)
)
}
)
.addMethod(
hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING,
_root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).streamingToUnaryCall[hello.world.TestMessage, hello.world.TestMessage]{ (r, m) =>
serviceAspect.visitStreamingToUnaryCall[hello.world.TestMessage, hello.world.TestMessage](
_root_.fs2.grpc.server.ServiceCallContext(m, hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING),
_root_.hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING,
_root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).streamingToUnaryCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage]{ (r, m) =>
serviceAspect.visitStreamingToUnaryCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage](
_root_.fs2.grpc.server.ServiceCallContext(m, _root_.hello.world.TestServiceGrpc.METHOD_CLIENT_STREAMING),
r,
(r, m) => serviceImpl.clientStreaming(r, m)
)
}
)
.addMethod(
hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING,
_root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).unaryToStreamingCall[hello.world.TestMessage, hello.world.TestMessage]{ (r, m) =>
serviceAspect.visitUnaryToStreamingCall[hello.world.TestMessage, hello.world.TestMessage](
_root_.fs2.grpc.server.ServiceCallContext(m, hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING),
_root_.hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING,
_root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).unaryToStreamingCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage]{ (r, m) =>
serviceAspect.visitUnaryToStreamingCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage](
_root_.fs2.grpc.server.ServiceCallContext(m, _root_.hello.world.TestServiceGrpc.METHOD_SERVER_STREAMING),
r,
(r, m) => serviceImpl.serverStreaming(r, m)
)
}
)
.addMethod(
hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING,
_root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).streamingToStreamingCall[hello.world.TestMessage, hello.world.TestMessage]{ (r, m) =>
serviceAspect.visitStreamingToStreamingCall[hello.world.TestMessage, hello.world.TestMessage](
_root_.fs2.grpc.server.ServiceCallContext(m, hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING),
_root_.hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING,
_root_.fs2.grpc.server.Fs2ServerCallHandler[G](dispatcher, serverOptions).streamingToStreamingCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage]{ (r, m) =>
serviceAspect.visitStreamingToStreamingCall[_root_.hello.world.TestMessage, _root_.hello.world.TestMessage](
_root_.fs2.grpc.server.ServiceCallContext(m, _root_.hello.world.TestServiceGrpc.METHOD_BOTH_STREAMING),
r,
(r, m) => serviceImpl.bothStreaming(r, m)
)
Expand Down
Loading
Loading