diff --git a/integrated_tests/imported_message/build.rs b/integrated_tests/imported_message/build.rs index a00008c..75c920e 100644 --- a/integrated_tests/imported_message/build.rs +++ b/integrated_tests/imported_message/build.rs @@ -1,8 +1,10 @@ fn main() -> Result<(), Box> { tonic_build::configure().include_file("mod.rs").compile( &[ - "primary/primary.proto", + "primary/service.proto", "primary/rectangle.proto", + "primary/request.proto", + "primary/response.proto", "imported/imported.proto", "zimported/zimported.proto", ], diff --git a/integrated_tests/imported_message/primary/request.proto b/integrated_tests/imported_message/primary/request.proto new file mode 100644 index 0000000..c92c691 --- /dev/null +++ b/integrated_tests/imported_message/primary/request.proto @@ -0,0 +1,20 @@ + +// Copyright 2015 gRPC authors. +// +syntax = "proto3"; + +option go_package = "github.com/pact-foundation/pact-go/v2/examples/grpc/primary"; +option java_multiple_files = true; +option java_package = "io.grpc.examples.primary"; +option java_outer_classname = "PrimaryProto"; + +package primary; + +// A request payload to get a Rectangle. +message RectangleLocationRequest { + // The width of the rectangle. + int32 x = 1; + int32 y = 2; + int32 width = 3; + int32 length = 4; +} diff --git a/integrated_tests/imported_message/primary/primary.proto b/integrated_tests/imported_message/primary/response.proto similarity index 57% rename from integrated_tests/imported_message/primary/primary.proto rename to integrated_tests/imported_message/primary/response.proto index b503a65..5e66270 100644 --- a/integrated_tests/imported_message/primary/primary.proto +++ b/integrated_tests/imported_message/primary/response.proto @@ -1,33 +1,19 @@ - -// Copyright 2015 gRPC authors. -// -syntax = "proto3"; - -option go_package = "github.com/pact-foundation/pact-go/v2/examples/grpc/primary"; -option java_multiple_files = true; -option java_package = "io.grpc.examples.primary"; -option java_outer_classname = "PrimaryProto"; - -import "primary/rectangle.proto"; -import "zimported/zimported.proto"; - -package primary; - -service Primary { - rpc GetRectangle(RectangleLocationRequest) returns (RectangleLocationResponse) {} -} - -// A request payload to get a Rectangle. -message RectangleLocationRequest { - // The width of the rectangle. - int32 x = 1; - int32 y = 2; - int32 width = 3; - int32 length = 4; -} - -// A response payload containing a Rectangle. -message RectangleLocationResponse { - // The location of the rectangle. - Rectangle rectangle = 1; -} + +// Copyright 2015 gRPC authors. +// +syntax = "proto3"; + +option go_package = "github.com/pact-foundation/pact-go/v2/examples/grpc/primary"; +option java_multiple_files = true; +option java_package = "io.grpc.examples.primary"; +option java_outer_classname = "PrimaryProto"; + +import "primary/rectangle.proto"; + +package primary; + +// A response payload containing a Rectangle. +message RectangleLocationResponse { + // The location of the rectangle. + Rectangle rectangle = 1; +} diff --git a/integrated_tests/imported_message/primary/service.proto b/integrated_tests/imported_message/primary/service.proto new file mode 100644 index 0000000..ede4823 --- /dev/null +++ b/integrated_tests/imported_message/primary/service.proto @@ -0,0 +1,18 @@ + +// Copyright 2015 gRPC authors. +// +syntax = "proto3"; + +option go_package = "github.com/pact-foundation/pact-go/v2/examples/grpc/primary"; +option java_multiple_files = true; +option java_package = "io.grpc.examples.primary"; +option java_outer_classname = "PrimaryProto"; + +import "primary/request.proto"; +import "primary/response.proto"; + +package primary; + +service Primary { + rpc GetRectangle(RectangleLocationRequest) returns (RectangleLocationResponse) {} +} diff --git a/integrated_tests/imported_message/src/lib.rs b/integrated_tests/imported_message/src/lib.rs index 905df0e..7042450 100644 --- a/integrated_tests/imported_message/src/lib.rs +++ b/integrated_tests/imported_message/src/lib.rs @@ -17,14 +17,14 @@ mod tests { async fn test_proto_client() { let _ = env_logger::builder().is_test(true).try_init(); - let mut pact_builder = PactBuilderAsync::new_v4("grpc-consumer-rust", "imported_message"); + let mut pact_builder: PactBuilderAsync = PactBuilderAsync::new_v4("grpc-consumer-rust", "imported_message"); let mock_server = pact_builder .using_plugin("protobuf", None) .await .synchronous_message_interaction( "package namespace not respected", |mut i| async move { - let proto_file = Path::new("primary/primary.proto") + let proto_file = Path::new("primary/service.proto") .canonicalize() .unwrap() .to_string_lossy()