-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aabd398
commit e8a756b
Showing
8 changed files
with
547 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Package grpc_wrappers_testing contains the test service that helps to test gRPC wrappers. | ||
package grpc_wrappers_testing //nolint:revive,stylecheck | ||
|
||
//go:generate protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative test.proto |
58 changes: 58 additions & 0 deletions
58
lib/testutils/httpmultibin/grpc_wrappers_testing/service.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package grpc_wrappers_testing | ||
|
||
import ( | ||
"context" | ||
|
||
wrappers "github.com/golang/protobuf/ptypes/wrappers" | ||
"google.golang.org/grpc" | ||
) | ||
|
||
// Register registers a test service that could be used for the testing gRPC wrappers | ||
func Register(r grpc.ServiceRegistrar) *service { | ||
s := &service{} | ||
|
||
RegisterServiceServer(r, s) | ||
|
||
return s | ||
} | ||
|
||
type service struct { | ||
UnimplementedServiceServer | ||
|
||
TestStringImplementation func(context.Context, *wrappers.StringValue) (*wrappers.StringValue, error) | ||
TestIntegerImplementation func(context.Context, *wrappers.Int64Value) (*wrappers.Int64Value, error) | ||
TestBooleanImplementation func(context.Context, *wrappers.BoolValue) (*wrappers.BoolValue, error) | ||
TestDoubleImplementation func(context.Context, *wrappers.DoubleValue) (*wrappers.DoubleValue, error) | ||
} | ||
|
||
func (s *service) TestString(ctx context.Context, in *wrappers.StringValue) (*wrappers.StringValue, error) { | ||
if s.TestStringImplementation != nil { | ||
return s.TestStringImplementation(ctx, in) | ||
} | ||
|
||
return s.UnimplementedServiceServer.TestString(ctx, in) | ||
} | ||
|
||
func (s *service) TestInteger(ctx context.Context, in *wrappers.Int64Value) (*wrappers.Int64Value, error) { | ||
if s.TestIntegerImplementation != nil { | ||
return s.TestIntegerImplementation(ctx, in) | ||
} | ||
|
||
return s.UnimplementedServiceServer.TestInteger(ctx, in) | ||
} | ||
|
||
func (s *service) TestBoolean(ctx context.Context, in *wrappers.BoolValue) (*wrappers.BoolValue, error) { | ||
if s.TestBooleanImplementation != nil { | ||
return s.TestBooleanImplementation(ctx, in) | ||
} | ||
|
||
return s.UnimplementedServiceServer.TestBoolean(ctx, in) | ||
} | ||
|
||
func (s *service) TestDouble(ctx context.Context, in *wrappers.DoubleValue) (*wrappers.DoubleValue, error) { | ||
if s.TestDoubleImplementation != nil { | ||
return s.TestDoubleImplementation(ctx, in) | ||
} | ||
|
||
return s.UnimplementedServiceServer.TestDouble(ctx, in) | ||
} |
98 changes: 98 additions & 0 deletions
98
lib/testutils/httpmultibin/grpc_wrappers_testing/test.pb.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
lib/testutils/httpmultibin/grpc_wrappers_testing/test.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
syntax = "proto3"; | ||
|
||
package grpc.wrappers.testing; | ||
|
||
// this proto contains service that helps tests some of well-known types or wrappers | ||
// https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/wrappers.proto | ||
|
||
import "google/protobuf/wrappers.proto"; | ||
|
||
option go_package ="./grpc_wrappers_testing"; | ||
|
||
service Service { | ||
rpc TestString(google.protobuf.StringValue) returns (google.protobuf.StringValue); | ||
rpc TestInteger(google.protobuf.Int64Value) returns (google.protobuf.Int64Value); | ||
rpc TestBoolean(google.protobuf.BoolValue) returns (google.protobuf.BoolValue); | ||
rpc TestDouble(google.protobuf.DoubleValue) returns (google.protobuf.DoubleValue); | ||
} |
Oops, something went wrong.