aboutsummaryrefslogtreecommitdiff
path: root/csharp/protos/extest
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/protos/extest')
-rw-r--r--csharp/protos/extest/unittest_extras.proto37
-rw-r--r--csharp/protos/extest/unittest_extras_full.proto72
-rw-r--r--csharp/protos/extest/unittest_extras_lite.proto117
-rw-r--r--csharp/protos/extest/unittest_extras_xmltest.proto54
-rw-r--r--csharp/protos/extest/unittest_generic_services.proto29
-rw-r--r--csharp/protos/extest/unittest_issues.proto137
-rw-r--r--csharp/protos/extest/unittest_rpc_interop.proto41
-rw-r--r--csharp/protos/extest/unittest_rpc_interop_lite.proto42
8 files changed, 529 insertions, 0 deletions
diff --git a/csharp/protos/extest/unittest_extras.proto b/csharp/protos/extest/unittest_extras.proto
new file mode 100644
index 00000000..91f10fbd
--- /dev/null
+++ b/csharp/protos/extest/unittest_extras.proto
@@ -0,0 +1,37 @@
+// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasProtoFile";
+option (google.protobuf.csharp_file_options).add_serializable = true;
+
+package protobuf_unittest_extra;
+
+option java_package = "com.google.protobuf";
+
+message TestUnpackedExtensions {
+ extensions 1 to max;
+}
+
+extend TestUnpackedExtensions {
+ repeated int32 unpacked_int32_extension = 90;
+ repeated int64 unpacked_int64_extension = 91;
+ repeated uint32 unpacked_uint32_extension = 92;
+ repeated uint64 unpacked_uint64_extension = 93;
+ repeated sint32 unpacked_sint32_extension = 94;
+ repeated sint64 unpacked_sint64_extension = 95;
+ repeated fixed32 unpacked_fixed32_extension = 96;
+ repeated fixed64 unpacked_fixed64_extension = 97;
+ repeated sfixed32 unpacked_sfixed32_extension = 98;
+ repeated sfixed64 unpacked_sfixed64_extension = 99;
+ repeated float unpacked_float_extension = 100;
+ repeated double unpacked_double_extension = 101;
+ repeated bool unpacked_bool_extension = 102;
+ repeated UnpackedExtensionsForeignEnum unpacked_enum_extension = 103;
+}
+
+enum UnpackedExtensionsForeignEnum {
+ FOREIGN_FOO = 4;
+ FOREIGN_BAR = 5;
+ FOREIGN_BAZ = 6;
+}
diff --git a/csharp/protos/extest/unittest_extras_full.proto b/csharp/protos/extest/unittest_extras_full.proto
new file mode 100644
index 00000000..a334bbf1
--- /dev/null
+++ b/csharp/protos/extest/unittest_extras_full.proto
@@ -0,0 +1,72 @@
+// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasFullProtoFile";
+
+package protobuf_unittest_extra;
+
+option optimize_for = CODE_SIZE;
+
+option java_package = "com.google.protobuf";
+
+message TestInteropPerson {
+ required string name = 1;
+ required int32 id = 2;
+ optional string email = 3;
+ repeated int32 codes = 10 [packed=true];
+
+ enum PhoneType {
+ MOBILE = 0;
+ HOME = 1;
+ WORK = 2;
+ }
+
+ message PhoneNumber {
+ required string number = 1;
+ optional PhoneType type = 2 [default = HOME];
+ }
+
+ repeated PhoneNumber phone = 4;
+
+ repeated group Addresses = 5 {
+ required string address = 1;
+ optional string address2 = 2;
+ required string city = 3;
+ required string state = 4;
+ required fixed32 zip = 5;
+ }
+
+ extensions 100 to 199;
+}
+
+message TestInteropEmployeeId {
+ required string number = 1;
+}
+
+extend TestInteropPerson {
+ required TestInteropEmployeeId employee_id = 126;
+}
+
+message TestMissingFieldsA {
+ required string name = 1;
+ required int32 id = 2;
+ optional string email = 3;
+
+ message SubA {
+ required int32 count = 5;
+ repeated string values = 6;
+ }
+ optional SubA testA = 11;
+}
+
+message TestMissingFieldsB {
+ required string name = 1;
+ required int32 id = 2;
+ optional string website = 4;
+
+ message SubB {
+ repeated string values = 7;
+ }
+ optional SubB testB = 12;
+}
diff --git a/csharp/protos/extest/unittest_extras_lite.proto b/csharp/protos/extest/unittest_extras_lite.proto
new file mode 100644
index 00000000..ea1bcd25
--- /dev/null
+++ b/csharp/protos/extest/unittest_extras_lite.proto
@@ -0,0 +1,117 @@
+// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasLiteProtoFile";
+option (google.protobuf.csharp_file_options).add_serializable = true;
+
+package protobuf_unittest_extra;
+
+option optimize_for = LITE_RUNTIME;
+
+option java_package = "com.google.protobuf";
+
+message TestRequiredLite {
+ required int32 d = 1;
+ required ExtraEnum en = 2 [default = DEFAULT];
+}
+
+enum ExtraEnum {
+ DEFAULT = 10;
+ EXLITE_FOO = 7;
+ EXLITE_BAR = 8;
+ EXLITE_BAZ = 9;
+}
+
+message TestInteropPersonLite {
+ required string name = 1;
+ required int32 id = 2;
+ optional string email = 3;
+ repeated int32 codes = 10 [packed=true];
+
+ enum PhoneType {
+ MOBILE = 0;
+ HOME = 1;
+ WORK = 2;
+ }
+
+ message PhoneNumber {
+ required string number = 1;
+ optional PhoneType type = 2 [default = HOME];
+ }
+
+ repeated PhoneNumber phone = 4;
+
+ repeated group Addresses = 5 {
+ required string address = 1;
+ optional string address2 = 2;
+ required string city = 3;
+ required string state = 4;
+ required fixed32 zip = 5;
+ }
+
+ extensions 100 to 199;
+}
+
+message TestInteropEmployeeIdLite {
+ required string number = 1;
+}
+
+extend TestInteropPersonLite {
+ required TestInteropEmployeeIdLite employee_id_lite = 126;
+}
+
+/* Removed from unittest_lite.proto and added back here */
+
+message TestUnpackedExtensionsLite {
+ extensions 1 to max;
+}
+
+message TestUnpackedTypesLite {
+ repeated int32 unpacked_int32 = 90;
+ repeated int64 unpacked_int64 = 91;
+ repeated uint32 unpacked_uint32 = 92;
+ repeated uint64 unpacked_uint64 = 93;
+ repeated sint32 unpacked_sint32 = 94;
+ repeated sint64 unpacked_sint64 = 95;
+ repeated fixed32 unpacked_fixed32 = 96;
+ repeated fixed64 unpacked_fixed64 = 97;
+ repeated sfixed32 unpacked_sfixed32 = 98;
+ repeated sfixed64 unpacked_sfixed64 = 99;
+ repeated float unpacked_float = 100;
+ repeated double unpacked_double = 101;
+ repeated bool unpacked_bool = 102;
+ repeated UnpackedTypesForeignEnumLite unpacked_enum = 103;
+}
+
+extend TestUnpackedExtensionsLite {
+ repeated int32 unpacked_int32_extension_lite = 90;
+ repeated int64 unpacked_int64_extension_lite = 91;
+ repeated uint32 unpacked_uint32_extension_lite = 92;
+ repeated uint64 unpacked_uint64_extension_lite = 93;
+ repeated sint32 unpacked_sint32_extension_lite = 94;
+ repeated sint64 unpacked_sint64_extension_lite = 95;
+ repeated fixed32 unpacked_fixed32_extension_lite = 96;
+ repeated fixed64 unpacked_fixed64_extension_lite = 97;
+ repeated sfixed32 unpacked_sfixed32_extension_lite = 98;
+ repeated sfixed64 unpacked_sfixed64_extension_lite = 99;
+ repeated float unpacked_float_extension_lite = 100;
+ repeated double unpacked_double_extension_lite = 101;
+ repeated bool unpacked_bool_extension_lite = 102;
+ repeated UnpackedTypesForeignEnumLite unpacked_enum_extension_lite = 103;
+}
+
+enum UnpackedTypesForeignEnumLite {
+ FOREIGN_LITE_FOO = 4;
+ FOREIGN_LITE_BAR = 5;
+ FOREIGN_LITE_BAZ = 6;
+}
+
+message BucketOfBytes {
+ optional bytes value = 1;
+
+}
+message BucketOfBytesEx {
+ optional bytes value = 1;
+ optional bytes value2 = 255;
+} \ No newline at end of file
diff --git a/csharp/protos/extest/unittest_extras_xmltest.proto b/csharp/protos/extest/unittest_extras_xmltest.proto
new file mode 100644
index 00000000..ab8088a7
--- /dev/null
+++ b/csharp/protos/extest/unittest_extras_xmltest.proto
@@ -0,0 +1,54 @@
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestXmlSerializerTestProtoFile";
+option (google.protobuf.csharp_file_options).add_serializable = true;
+
+package protobuf_unittest_extra;
+
+option optimize_for = SPEED;
+
+enum EnumOptions {
+ ONE = 0;
+ TWO = 1;
+ THREE = 2;
+}
+
+message TestXmlChild {
+ repeated EnumOptions options = 3;
+ optional bytes binary = 4;
+}
+
+message TestXmlNoFields {
+}
+
+message TestXmlRescursive {
+ optional TestXmlRescursive child = 1;
+}
+
+message TestXmlMessage {
+
+ optional int64 number = 6;
+ repeated int32 numbers = 2;
+ optional string text = 3;
+ repeated string textlines = 700;
+ optional bool valid = 5;
+
+ optional TestXmlChild child = 1;
+ repeated group Children = 401 {
+ repeated EnumOptions options = 3;
+ optional bytes binary = 4;
+ }
+
+extensions 100 to 199;
+}
+
+message TestXmlExtension {
+ required int32 number = 1;
+}
+
+extend TestXmlMessage {
+ optional EnumOptions extension_enum = 101;
+ optional string extension_text = 102;
+ repeated int32 extension_number = 103 [packed = true];
+ optional TestXmlExtension extension_message = 199;
+}
diff --git a/csharp/protos/extest/unittest_generic_services.proto b/csharp/protos/extest/unittest_generic_services.proto
new file mode 100644
index 00000000..3fe2e8eb
--- /dev/null
+++ b/csharp/protos/extest/unittest_generic_services.proto
@@ -0,0 +1,29 @@
+// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+import "google/protobuf/unittest.proto";
+import "google/protobuf/unittest_custom_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestGenericServices";
+
+option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;
+
+// We don't put this in a package within proto2 because we need to make sure
+// that the generated code doesn't depend on being in the proto2 namespace.
+package protobuf_unittest;
+
+option optimize_for = SPEED;
+
+service TestGenericService {
+ rpc Foo(FooRequest) returns (FooResponse);
+ rpc Bar(BarRequest) returns (BarResponse);
+}
+
+service TestGenericServiceWithCustomOptions {
+ option (service_opt1) = -9876543210;
+
+ rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) {
+ option (method_opt1) = METHODOPT1_VAL2;
+ }
+}
+
diff --git a/csharp/protos/extest/unittest_issues.proto b/csharp/protos/extest/unittest_issues.proto
new file mode 100644
index 00000000..cb803791
--- /dev/null
+++ b/csharp/protos/extest/unittest_issues.proto
@@ -0,0 +1,137 @@
+// These proto descriptors have at one time been reported as an issue or defect.
+// They are kept here to replicate the issue, and continue to verify the fix.
+import "google/protobuf/csharp_options.proto";
+
+// Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer library types are qualified
+option (google.protobuf.csharp_file_options).namespace = "UnitTest.Issues.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasIssuesProtoFile";
+
+package unittest_issues;
+option optimize_for = SPEED;
+
+// The following is a representative set of features
+/*
+enum EnumOptions {
+ ONE = 0;
+ TWO = 1;
+ THREE = 2;
+}
+
+message TestBasicChild
+{
+ repeated EnumOptions options = 3;
+ optional bytes binary = 4;
+}
+
+message TestBasicNoFields {
+}
+
+message TestBasicRescursive {
+ optional TestBasicRescursive child = 1;
+}
+
+message TestBasicMessage {
+
+ optional int64 number = 6;
+ repeated int32 numbers = 2;
+ optional string text = 3;
+ repeated string textlines = 700;
+ optional bool valid = 5;
+
+ optional TestBasicChild child = 1;
+ repeated group Children = 401
+ {
+ repeated EnumOptions options = 3;
+ optional bytes binary = 4;
+ }
+
+ extensions 100 to 199;
+}
+
+message TestBasicExtension {
+ required int32 number = 1;
+}
+
+extend TestBasicMessage {
+ optional EnumOptions extension_enum = 101;
+ optional string extension_text = 102;
+ repeated int32 extension_number = 103 [packed = true];
+ optional TestBasicExtension extension_message = 199;
+}
+
+// Issue for non-qualified type reference in new services generation
+option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH;
+
+service TestGenericService {
+ rpc Foo(TestBasicNoFields) returns (TestBasicMessage);
+ rpc Bar(TestBasicNoFields) returns (TestBasicMessage);
+}
+*/
+// Issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13
+
+message A {
+ optional int32 _A = 1;
+}
+
+message B {
+ optional int32 B_ = 1;
+}
+
+message AB {
+ optional int32 a_b = 1;
+}
+
+// Similar issue with numeric names
+message NumberField {
+ optional int32 _01 = 1;
+}
+
+// Issue 28: Circular message dependencies result in null defaults for DefaultInstance
+
+message MyMessageAReferenceB {
+ required MyMessageBReferenceA value = 1;
+}
+
+message MyMessageBReferenceA {
+ required MyMessageAReferenceB value = 1;
+}
+
+// issue 19 - negative enum values
+
+enum NegativeEnum {
+ FiveBelow = -5;
+ MinusOne = -1;
+ Zero = 0;
+}
+
+message NegativeEnumMessage {
+ optional NegativeEnum value = 1;
+ repeated NegativeEnum values = 2;
+ repeated NegativeEnum packed_values = 3 [packed=true];
+}
+
+// Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21
+// Decorate fields with [deprecated=true] as [System.Obsolete]
+
+message DeprecatedChild {
+}
+
+enum DeprecatedEnum {
+ one = 1;
+}
+
+message DeprecatedFieldsMessage {
+ optional int32 PrimitiveValue = 1 [deprecated = true];
+ repeated int32 PrimitiveArray = 2 [deprecated = true];
+
+ optional DeprecatedChild MessageValue = 3 [deprecated = true];
+ repeated DeprecatedChild MessageArray = 4 [deprecated = true];
+
+ optional DeprecatedEnum EnumValue = 5 [deprecated = true];
+ repeated DeprecatedEnum EnumArray = 6 [deprecated = true];
+}
+
+// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45
+message ItemField {
+ optional int32 item = 1;
+}
diff --git a/csharp/protos/extest/unittest_rpc_interop.proto b/csharp/protos/extest/unittest_rpc_interop.proto
new file mode 100644
index 00000000..dec5b872
--- /dev/null
+++ b/csharp/protos/extest/unittest_rpc_interop.proto
@@ -0,0 +1,41 @@
+// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestRpcInterop";
+
+option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH;
+
+option optimize_for = SPEED;
+
+message SearchRequest {
+ repeated string Criteria = 1;
+}
+
+message SearchResponse {
+ message ResultItem {
+ required string url = 1;
+ optional string name = 2;
+ }
+
+ repeated ResultItem results = 1;
+}
+
+message RefineSearchRequest {
+ repeated string Criteria = 1;
+ required SearchResponse previous_results = 2;
+}
+
+service SearchService {
+ /*
+ Add this option to specify the GuidAttribute on the service interface
+ option (google.protobuf.csharp_service_options).interface_id = "{A65F0925-FD11-4f94-B166-89AC4F027205}";
+ */
+ rpc Search (SearchRequest) returns (SearchResponse)
+ /*
+ Add this option to specify the DispIdAttribute on the service interface
+ { option (google.protobuf.csharp_method_options).dispatch_id = 5; }
+ */ ;
+
+ rpc RefineSearch (RefineSearchRequest) returns (SearchResponse);
+}
diff --git a/csharp/protos/extest/unittest_rpc_interop_lite.proto b/csharp/protos/extest/unittest_rpc_interop_lite.proto
new file mode 100644
index 00000000..62d1c6a6
--- /dev/null
+++ b/csharp/protos/extest/unittest_rpc_interop_lite.proto
@@ -0,0 +1,42 @@
+// Additional options required for C# generation. File from copyright
+// line onwards is as per original distribution.
+import "google/protobuf/csharp_options.proto";
+option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos";
+option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestRpcInteropLite";
+
+option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH;
+
+option optimize_for = LITE_RUNTIME;
+package unittest_rpc_interop_lite;
+
+message SearchRequest {
+ repeated string Criteria = 1;
+}
+
+message SearchResponse {
+ message ResultItem {
+ required string url = 1;
+ optional string name = 2;
+ }
+
+ repeated ResultItem results = 1;
+}
+
+message RefineSearchRequest {
+ repeated string Criteria = 1;
+ required SearchResponse previous_results = 2;
+}
+
+service SearchService {
+ /*
+ Add this option to specify the GuidAttribute on the service interface
+ option (google.protobuf.csharp_service_options).interface_id = "{A65F0925-FD11-4f94-B166-89AC4F027205}";
+ */
+ rpc Search (SearchRequest) returns (SearchResponse)
+ /*
+ Add this option to specify the DispIdAttribute on the service interface
+ { option (google.protobuf.csharp_method_options).dispatch_id = 5; }
+ */ ;
+
+ rpc RefineSearch (RefineSearchRequest) returns (SearchResponse);
+}