OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 10 matching lines...) Expand all Loading... |
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
| 31 // Proto to test proto3 maps. |
31 syntax = "proto3"; | 32 syntax = "proto3"; |
32 | 33 |
33 package google.protobuf.testing; | 34 package google.protobuf.testing.maps; |
34 | 35 option java_package = "com.google.protobuf.testing.maps"; |
35 // Top-level test cases proto used by MarshallingTest. See description | |
36 // at the top of the class MarshallingTest for details on how to write | |
37 // test cases. | |
38 message MapsTestCases { | |
39 EmptyMap empty_map = 1; | |
40 StringtoInt string_to_int = 2; | |
41 IntToString int_to_string = 3; | |
42 Mixed1 mixed1 = 4; | |
43 Mixed2 mixed2 = 5; | |
44 MapOfObjects map_of_objects = 6; | |
45 | |
46 // Empty key tests | |
47 StringtoInt empty_key_string_to_int1 = 7; | |
48 StringtoInt empty_key_string_to_int2 = 8; | |
49 StringtoInt empty_key_string_to_int3 = 9; | |
50 BoolToString empty_key_bool_to_string = 10; | |
51 IntToString empty_key_int_to_string = 11; | |
52 Mixed1 empty_key_mixed = 12; | |
53 MapOfObjects empty_key_map_objects = 13; | |
54 } | |
55 | |
56 message EmptyMap { | |
57 map<int32, int32> map = 1; | |
58 } | |
59 | |
60 message StringtoInt { | |
61 map<string, int32> map = 1; | |
62 } | |
63 | |
64 message IntToString { | |
65 map<int32, string> map = 1; | |
66 } | |
67 | |
68 message BoolToString { | |
69 map<bool, string> map = 1; | |
70 } | |
71 | |
72 message Mixed1 { | |
73 string msg = 1; | |
74 map<string, float> map = 2; | |
75 } | |
76 | |
77 message Mixed2 { | |
78 enum E { | |
79 E0 = 0; | |
80 E1 = 1; | |
81 E2 = 2; | |
82 E3 = 3; | |
83 } | |
84 map<int32, bool> map = 1; | |
85 E ee = 2; | |
86 } | |
87 | |
88 message MapOfObjects { | |
89 message M { | |
90 string inner_text = 1; | |
91 } | |
92 map<string, M> map = 1; | |
93 } | |
94 | |
95 message DummyRequest { | |
96 } | |
97 | |
98 service MapsTestService { | |
99 rpc Call(DummyRequest) returns (MapsTestCases); | |
100 } | |
101 | 36 |
102 message MapIn { | 37 message MapIn { |
103 string other = 1; | 38 string other = 1; |
104 repeated string things = 2; | 39 repeated string things = 2; |
105 map<string, string> map_input = 3; | 40 map<string, string> map_input = 3; |
106 } | 41 } |
107 | 42 |
108 message MapOut { | 43 message MapOut { |
109 map<string, MapM> map1 = 1; | 44 map<string, MapM> map1 = 1; |
110 map<string, MapOut> map2 = 2; | 45 map<string, MapOut> map2 = 2; |
(...skipping 26 matching lines...) Expand all Loading... |
137 bool key = 1; | 72 bool key = 1; |
138 string value = 2; | 73 string value = 2; |
139 } | 74 } |
140 repeated Map4Entry map4 = 5; | 75 repeated Map4Entry map4 = 5; |
141 string bar = 4; | 76 string bar = 4; |
142 } | 77 } |
143 | 78 |
144 message MapM { | 79 message MapM { |
145 string foo = 1; | 80 string foo = 1; |
146 } | 81 } |
| 82 |
| 83 service TestService { |
| 84 rpc Call1(MapIn) returns (MapOut); |
| 85 rpc Call2(MapIn) returns (MapOut); |
| 86 } |
OLD | NEW |