@@ -167,6 +167,8 @@ public void testOnlyPublish() throws InterruptedException {
167
167
public void testAll () throws Exception {
168
168
169
169
int timeoutPerSub = 1000 ;
170
+ Map <String , String > parameter = new HashMap <>();
171
+ parameter .put (SofaRegistryConstants .SOFA_GROUP_KEY , "SOFA_TEST" );
170
172
171
173
ServerConfig serverConfig = new ServerConfig ()
172
174
.setProtocol ("bolt" )
@@ -183,7 +185,8 @@ public void testAll() throws Exception {
183
185
.setSerialization ("hessian2" )
184
186
.setServer (serverConfig )
185
187
.setWeight (222 )
186
- .setTimeout (3000 );
188
+ .setTimeout (3000 )
189
+ .setParameters (parameter );
187
190
188
191
// 注册
189
192
registry .register (provider );
@@ -196,7 +199,8 @@ public void testAll() throws Exception {
196
199
.setSubscribe (true )
197
200
.setSerialization ("java" )
198
201
.setInvokeType ("sync" )
199
- .setTimeout (4444 );
202
+ .setTimeout (4444 )
203
+ .setParameters (parameter );
200
204
201
205
String tag0 = MeshRegistryHelper .buildMeshKey (provider , serverConfig .getProtocol ());
202
206
String tag1 = MeshRegistryHelper .buildMeshKey (consumer , consumer .getProtocol ());
@@ -205,6 +209,7 @@ public void testAll() throws Exception {
205
209
PublishServiceRequest publishServiceRequest = registry .buildPublishServiceRequest (tag0 ,
206
210
serverConfig .getProtocol (), providerInfo , "test-server" );
207
211
Assert .assertEquals (serverConfig .getProtocol (), publishServiceRequest .getProtocolType ());
212
+ Assert .assertEquals ("SOFA_TEST" , publishServiceRequest .getGroup ());
208
213
209
214
// 订阅
210
215
MeshRegistryTest .MockProviderInfoListener providerInfoListener = new MeshRegistryTest .MockProviderInfoListener ();
@@ -216,6 +221,8 @@ public void testAll() throws Exception {
216
221
Assert .assertTrue (ps .toString (), ps .size () == 1 );
217
222
SubscribeServiceRequest subscribeServiceRequest = registry .buildSubscribeServiceRequest (consumer );
218
223
Assert .assertEquals (consumer .getProtocol (), subscribeServiceRequest .getProtocolType ());
224
+ Assert .assertEquals ("SOFA_TEST" , subscribeServiceRequest .getGroup ());
225
+ Assert .assertNotNull (subscribeServiceRequest .getProperties ());
219
226
220
227
// 反注册
221
228
CountDownLatch latch = new CountDownLatch (1 );
@@ -226,6 +233,7 @@ public void testAll() throws Exception {
226
233
Assert .assertTrue (ps .size () == 1 );
227
234
UnPublishServiceRequest unPublishServiceRequest = registry .buildUnPublishServiceRequest (tag0 , providerInfo );
228
235
Assert .assertEquals (serverConfig .getProtocol (), unPublishServiceRequest .getProtocolType ());
236
+ Assert .assertEquals ("SOFA_TEST" , unPublishServiceRequest .getGroup ());
229
237
230
238
// 一次发2个端口的再次注册
231
239
latch = new CountDownLatch (1 );
@@ -246,7 +254,8 @@ public void testAll() throws Exception {
246
254
.setSubscribe (true )
247
255
.setSerialization ("java" )
248
256
.setInvokeType ("sync" )
249
- .setTimeout (4444 );
257
+ .setTimeout (4444 )
258
+ .setParameters (parameter );
250
259
CountDownLatch latch2 = new CountDownLatch (1 );
251
260
MeshRegistryTest .MockProviderInfoListener providerInfoListener2 = new MeshRegistryTest .MockProviderInfoListener ();
252
261
providerInfoListener2 .setCountDownLatch (latch2 );
@@ -261,6 +270,7 @@ public void testAll() throws Exception {
261
270
registry .unSubscribe (consumer );
262
271
UnSubscribeServiceRequest unSubscribeServiceRequest = registry .buildUnSubscribeServiceRequest (consumer );
263
272
Assert .assertEquals (consumer .getProtocol (), unSubscribeServiceRequest .getProtocolType ());
273
+ Assert .assertEquals ("SOFA_TEST" , unSubscribeServiceRequest .getGroup ());
264
274
265
275
// 批量反注册,判断订阅者2的数据
266
276
latch = new CountDownLatch (1 );
0 commit comments