@@ -37,11 +37,11 @@ class PathMatcherBuilder<const TestMethod*> {
37
37
public:
38
38
MOCK_METHOD5 (Register,
39
39
bool (const std::string&, const std::string&, const std::string&,
40
- const std::set <std::string>&, const TestMethod*));
40
+ const std::unordered_set <std::string>&, const TestMethod*));
41
41
};
42
- }
43
- }
44
- }
42
+ } // namespace transcoding
43
+ } // namespace grpc
44
+ } // namespace google
45
45
46
46
class PathMatcherUtilityTest : public ::testing::Test {
47
47
public:
@@ -63,13 +63,15 @@ TEST_F(PathMatcherUtilityTest, RegisterGet) {
63
63
HttpRule http_rule;
64
64
http_rule.set_get (" /path" );
65
65
http_rule.set_body (" body" );
66
- EXPECT_CALL (pmb, Register (Eq (" GET" ), Eq (" /path" ), Eq (" body" ),
67
- Eq (std::set<std::string>()), Eq (&method1_)))
66
+ EXPECT_CALL (pmb,
67
+ Register (Eq (" GET" ), Eq (" /path" ), Eq (" body" ),
68
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
68
69
.WillOnce (Return (true ));
69
70
ASSERT_TRUE (
70
71
PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, &method1_));
71
- EXPECT_CALL (pmb, Register (Eq (" GET" ), Eq (" /path" ), Eq (" body" ),
72
- Eq (std::set<std::string>{" key" }), Eq (&method2_)))
72
+ EXPECT_CALL (
73
+ pmb, Register (Eq (" GET" ), Eq (" /path" ), Eq (" body" ),
74
+ Eq (std::unordered_set<std::string>{" key" }), Eq (&method2_)))
73
75
.WillOnce (Return (false ));
74
76
ASSERT_FALSE (PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, {" key" },
75
77
&method2_));
@@ -79,13 +81,15 @@ TEST_F(PathMatcherUtilityTest, RegisterPut) {
79
81
HttpRule http_rule;
80
82
http_rule.set_put (" /path" );
81
83
http_rule.set_body (" body" );
82
- EXPECT_CALL (pmb, Register (Eq (" PUT" ), Eq (" /path" ), Eq (" body" ),
83
- Eq (std::set<std::string>()), Eq (&method1_)))
84
+ EXPECT_CALL (pmb,
85
+ Register (Eq (" PUT" ), Eq (" /path" ), Eq (" body" ),
86
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
84
87
.WillOnce (Return (true ));
85
88
ASSERT_TRUE (
86
89
PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, &method1_));
87
- EXPECT_CALL (pmb, Register (Eq (" PUT" ), Eq (" /path" ), Eq (" body" ),
88
- Eq (std::set<std::string>{" key" }), Eq (&method2_)))
90
+ EXPECT_CALL (
91
+ pmb, Register (Eq (" PUT" ), Eq (" /path" ), Eq (" body" ),
92
+ Eq (std::unordered_set<std::string>{" key" }), Eq (&method2_)))
89
93
.WillOnce (Return (false ));
90
94
ASSERT_FALSE (PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, {" key" },
91
95
&method2_));
@@ -95,13 +99,15 @@ TEST_F(PathMatcherUtilityTest, RegisterPost) {
95
99
HttpRule http_rule;
96
100
http_rule.set_post (" /path" );
97
101
http_rule.set_body (" body" );
98
- EXPECT_CALL (pmb, Register (Eq (" POST" ), Eq (" /path" ), Eq (" body" ),
99
- Eq (std::set<std::string>()), Eq (&method1_)))
102
+ EXPECT_CALL (pmb,
103
+ Register (Eq (" POST" ), Eq (" /path" ), Eq (" body" ),
104
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
100
105
.WillOnce (Return (true ));
101
106
ASSERT_TRUE (
102
107
PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, &method1_));
103
- EXPECT_CALL (pmb, Register (Eq (" POST" ), Eq (" /path" ), Eq (" body" ),
104
- Eq (std::set<std::string>{" key" }), Eq (&method2_)))
108
+ EXPECT_CALL (
109
+ pmb, Register (Eq (" POST" ), Eq (" /path" ), Eq (" body" ),
110
+ Eq (std::unordered_set<std::string>{" key" }), Eq (&method2_)))
105
111
.WillOnce (Return (false ));
106
112
ASSERT_FALSE (PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, {" key" },
107
113
&method2_));
@@ -111,13 +117,15 @@ TEST_F(PathMatcherUtilityTest, RegisterDelete) {
111
117
HttpRule http_rule;
112
118
http_rule.set_delete_ (" /path" );
113
119
http_rule.set_body (" body" );
114
- EXPECT_CALL (pmb, Register (Eq (" DELETE" ), Eq (" /path" ), Eq (" body" ),
115
- Eq (std::set<std::string>()), Eq (&method1_)))
120
+ EXPECT_CALL (pmb,
121
+ Register (Eq (" DELETE" ), Eq (" /path" ), Eq (" body" ),
122
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
116
123
.WillOnce (Return (true ));
117
124
ASSERT_TRUE (
118
125
PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, &method1_));
119
- EXPECT_CALL (pmb, Register (Eq (" DELETE" ), Eq (" /path" ), Eq (" body" ),
120
- Eq (std::set<std::string>{" key" }), Eq (&method2_)))
126
+ EXPECT_CALL (
127
+ pmb, Register (Eq (" DELETE" ), Eq (" /path" ), Eq (" body" ),
128
+ Eq (std::unordered_set<std::string>{" key" }), Eq (&method2_)))
121
129
.WillOnce (Return (false ));
122
130
ASSERT_FALSE (PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, {" key" },
123
131
&method2_));
@@ -127,13 +135,15 @@ TEST_F(PathMatcherUtilityTest, RegisterPatch) {
127
135
HttpRule http_rule;
128
136
http_rule.set_patch (" /path" );
129
137
http_rule.set_body (" body" );
130
- EXPECT_CALL (pmb, Register (Eq (" PATCH" ), Eq (" /path" ), Eq (" body" ),
131
- Eq (std::set<std::string>()), Eq (&method1_)))
138
+ EXPECT_CALL (pmb,
139
+ Register (Eq (" PATCH" ), Eq (" /path" ), Eq (" body" ),
140
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
132
141
.WillOnce (Return (true ));
133
142
ASSERT_TRUE (
134
143
PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, &method1_));
135
- EXPECT_CALL (pmb, Register (Eq (" PATCH" ), Eq (" /path" ), Eq (" body" ),
136
- Eq (std::set<std::string>{" key" }), Eq (&method2_)))
144
+ EXPECT_CALL (
145
+ pmb, Register (Eq (" PATCH" ), Eq (" /path" ), Eq (" body" ),
146
+ Eq (std::unordered_set<std::string>{" key" }), Eq (&method2_)))
137
147
.WillOnce (Return (false ));
138
148
ASSERT_FALSE (PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, {" key" },
139
149
&method2_));
@@ -144,13 +154,15 @@ TEST_F(PathMatcherUtilityTest, RegisterCustom) {
144
154
http_rule.mutable_custom ()->set_kind (" OPTIONS" );
145
155
http_rule.mutable_custom ()->set_path (" /custom_path" );
146
156
http_rule.set_body (" body" );
147
- EXPECT_CALL (pmb, Register (Eq (" OPTIONS" ), Eq (" /custom_path" ), Eq (" body" ),
148
- Eq (std::set<std::string>()), Eq (&method1_)))
157
+ EXPECT_CALL (pmb,
158
+ Register (Eq (" OPTIONS" ), Eq (" /custom_path" ), Eq (" body" ),
159
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
149
160
.WillOnce (Return (true ));
150
161
ASSERT_TRUE (
151
162
PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, &method1_));
152
- EXPECT_CALL (pmb, Register (Eq (" OPTIONS" ), Eq (" /custom_path" ), Eq (" body" ),
153
- Eq (std::set<std::string>{" key" }), Eq (&method2_)))
163
+ EXPECT_CALL (
164
+ pmb, Register (Eq (" OPTIONS" ), Eq (" /custom_path" ), Eq (" body" ),
165
+ Eq (std::unordered_set<std::string>{" key" }), Eq (&method2_)))
154
166
.WillOnce (Return (false ));
155
167
ASSERT_FALSE (PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, {" key" },
156
168
&method2_));
@@ -173,26 +185,32 @@ TEST_F(PathMatcherUtilityTest, RegisterAdditionalBindings) {
173
185
HttpRule& custom_http_rule3 = *http_rule.add_additional_bindings ();
174
186
custom_http_rule3.set_put (" /put_path" );
175
187
176
- EXPECT_CALL (pmb, Register (Eq (" GET" ), Eq (" /path" ), Eq (" body" ),
177
- Eq (std::set<std::string>()), Eq (&method1_)))
188
+ EXPECT_CALL (pmb,
189
+ Register (Eq (" GET" ), Eq (" /path" ), Eq (" body" ),
190
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
178
191
.WillOnce (Return (true ));
179
- EXPECT_CALL (pmb, Register (Eq (" OPTIONS" ), Eq (" /custom_path" ), Eq (" body1" ),
180
- Eq (std::set<std::string>()), Eq (&method1_)))
192
+ EXPECT_CALL (pmb,
193
+ Register (Eq (" OPTIONS" ), Eq (" /custom_path" ), Eq (" body1" ),
194
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
181
195
.WillOnce (Return (true ));
182
- EXPECT_CALL (pmb, Register (Eq (" HEAD" ), Eq (" /path" ), Eq (" " ),
183
- Eq (std::set<std::string>()), Eq (&method1_)))
196
+ EXPECT_CALL (pmb,
197
+ Register (Eq (" HEAD" ), Eq (" /path" ), Eq (" " ),
198
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
184
199
.WillOnce (Return (true ));
185
- EXPECT_CALL (pmb, Register (Eq (" PUT" ), Eq (" /put_path" ), Eq (" " ),
186
- Eq (std::set<std::string>()), Eq (&method1_)))
200
+ EXPECT_CALL (pmb,
201
+ Register (Eq (" PUT" ), Eq (" /put_path" ), Eq (" " ),
202
+ Eq (std::unordered_set<std::string>()), Eq (&method1_)))
187
203
.WillOnce (Return (true ));
188
204
ASSERT_TRUE (
189
205
PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, &method1_));
190
206
191
- EXPECT_CALL (pmb, Register (Eq (" GET" ), Eq (" /path" ), Eq (" body" ),
192
- Eq (std::set<std::string>{" key" }), Eq (&method2_)))
207
+ EXPECT_CALL (
208
+ pmb, Register (Eq (" GET" ), Eq (" /path" ), Eq (" body" ),
209
+ Eq (std::unordered_set<std::string>{" key" }), Eq (&method2_)))
193
210
.WillOnce (Return (true ));
194
- EXPECT_CALL (pmb, Register (Eq (" OPTIONS" ), Eq (" /custom_path" ), Eq (" body1" ),
195
- Eq (std::set<std::string>{" key" }), Eq (&method2_)))
211
+ EXPECT_CALL (
212
+ pmb, Register (Eq (" OPTIONS" ), Eq (" /custom_path" ), Eq (" body1" ),
213
+ Eq (std::unordered_set<std::string>{" key" }), Eq (&method2_)))
196
214
.WillOnce (Return (false ));
197
215
ASSERT_FALSE (PathMatcherUtility::RegisterByHttpRule (pmb, http_rule, {" key" },
198
216
&method2_));
0 commit comments