@@ -149,27 +149,41 @@ public void testConfig() {
149149 }
150150
151151 @ Test
152- public void testSetCallee () {
153- ExtensionLoader
154- .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
152+ public void testNoSetCallee () {
153+ ExtensionLoader .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
155154 BackendConfig config = new BackendConfig ();
156155 config .setName ("trpc.calleeapp.calleeserver.calleeservice.calleemethod" );
157156 config .setNamingUrl ("ip://127.0.0.1:8888" );
158157 config .setExtMap (ImmutableMap .of ("attalog" , (Object ) "attalog" ));
159158 config .setFilters (Lists .newArrayList ("attalog" ));
160159 config .setGroup ("group" );
161- config .setCallee ("trpc.app.server.service" );
162160 config .init ();
163161 assertEquals (config .getCalleeApp (), "" );
164162 assertEquals (config .getCalleeServer (), "" );
165163 assertEquals (config .getCalleeService (), "" );
166164 assertEquals ("127.0.0.1:8888" , config .getCallee ());
167165 }
168166
167+ @ Test
168+ public void testSetCallee () {
169+ ExtensionLoader .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
170+ BackendConfig config = new BackendConfig ();
171+ config .setName ("trpc.calleeapp.calleeserver.calleeservice.calleemethod" );
172+ config .setNamingUrl ("ip://127.0.0.1:8888" );
173+ config .setExtMap (ImmutableMap .of ("attalog" , (Object ) "attalog" ));
174+ config .setFilters (Lists .newArrayList ("attalog" ));
175+ config .setGroup ("group" );
176+ config .setCallee ("trpc.app.server.service" );
177+ config .init ();
178+ assertEquals (config .getCalleeApp (), "app" );
179+ assertEquals (config .getCalleeServer (), "server" );
180+ assertEquals (config .getCalleeService (), "service" );
181+ assertEquals ("trpc.app.server.service" , config .getCallee ());
182+ }
183+
169184 @ Test
170185 public void testNameSpace () {
171- ExtensionLoader
172- .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
186+ ExtensionLoader .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
173187 BackendConfig config = new BackendConfig ();
174188 config .setName ("trpc.calleeapp.calleeserver.calleeservice.calleemethod" );
175189 config .setNamingUrl ("ip://127.0.0.1:8888" );
@@ -183,16 +197,15 @@ public void testNameSpace() {
183197 config .init ();
184198 config .toString ();
185199 assertEquals (0 , config .getNamingMap ().size ());
186- assertEquals (config .getCalleeApp (), "" );
187- assertEquals (config .getCalleeServer (), "" );
188- assertEquals (config .getCalleeService (), "" );
200+ assertEquals (config .getCalleeApp (), "app " );
201+ assertEquals (config .getCalleeServer (), "server " );
202+ assertEquals (config .getCalleeService (), "service " );
189203 assertEquals (config .getNamingOptions ().getExtMap ().get ("namespace" ), "abc" );
190204 }
191205
192206 @ Test
193207 public void testIp () {
194- ExtensionLoader
195- .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
208+ ExtensionLoader .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
196209 ExtensionLoader .registerPlugin (ThreadWorkerPool .newThreadWorkerPoolConfig ("thread" , 10 , Boolean .FALSE ));
197210 BackendConfig config = new BackendConfig ();
198211 config .setNamingUrl ("ip://127.0.0.1:8888" );
@@ -237,10 +250,8 @@ public void testIp() {
237250
238251 @ Test
239252 public void test () {
240- ExtensionLoader
241- .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
242- ExtensionLoader .registerPlugin (ThreadWorkerPool .newThreadWorkerPoolConfig ("thread" , 10 ,
243- 10 , Boolean .FALSE ));
253+ ExtensionLoader .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
254+ ExtensionLoader .registerPlugin (ThreadWorkerPool .newThreadWorkerPoolConfig ("thread" , 10 , Boolean .FALSE ));
244255 BackendConfig config = new BackendConfig ();
245256 config .setCallee ("trpc.calleeapp.calleeserver.calleeservice.calleemethod" );
246257 config .setNamingUrl ("ip://127.0.0.1:8888" );
@@ -273,9 +284,9 @@ public void test() {
273284 assertEquals (config .getServiceInterface (), GenericClient .class );
274285 assertEquals (config .getRequestTimeout (), 1234 );
275286 assertEquals (config .getVersion (), "v888" );
276- assertEquals (config .getCalleeApp (), "" );
277- assertEquals (config .getCalleeServer (), "" );
278- assertEquals (config .getCalleeService (), "" );
287+ assertEquals (config .getCalleeApp (), "calleeapp " );
288+ assertEquals (config .getCalleeServer (), "calleeserver " );
289+ assertEquals (config .getCalleeService (), "calleeservice " );
279290 ServiceId serviceId = config .toNamingServiceId ();
280291 assertEquals (serviceId .getGroup (), "group" );
281292 assertEquals (serviceId .getServiceName (), "127.0.0.1:8888" );
@@ -294,8 +305,7 @@ public void testGetProxy() {
294305 config .setServiceInterface (GenericClient .class );
295306 config .setName ("client" );
296307 config .setNamingUrl ("ip://127.0.0.1:12345" );
297- ConfigManager .getInstance ().getClientConfig ().getBackendConfigMap ()
298- .put ("client" , config );
308+ ConfigManager .getInstance ().getClientConfig ().getBackendConfigMap ().put ("client" , config );
299309 ConsumerConfig <GenericClient > consumerConfig = new ConsumerConfig <>();
300310 consumerConfig .setBackendConfig (config );
301311 consumerConfig .setServiceInterface (GenericClient .class );
@@ -317,8 +327,7 @@ public void testGetProxy() {
317327
318328 @ Test
319329 public void testNotDefault () {
320- ExtensionLoader
321- .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
330+ ExtensionLoader .registerPlugin (new PluginConfig ("attalog" , Filter .class , RemoteLoggerTest .class ));
322331 ExtensionLoader .registerPlugin (ThreadWorkerPool .newThreadWorkerPoolConfig ("thread" , 10 , Boolean .FALSE ));
323332 BackendConfig config = new BackendConfig ();
324333 config .setName ("trpc.calleeapp.calleeserver.calleeservice.calleemethod" );
0 commit comments