@@ -89,77 +89,77 @@ public void after() {
89
89
SofaTracerConfiguration .setProperty (SofaTracerConfiguration .STAT_LOG_INTERVAL , "" );
90
90
}
91
91
92
- @ Test
93
- public void testTracer () throws Exception {
94
- RegistryConfig registryConfig = new RegistryConfig ();
95
- ApplicationConfig config = new ApplicationConfig ();
96
- config .setName ("test-server" );
97
- registryConfig .setAddress ("N/A" );
98
- //The service caller connects to the registry and sets the properties.
99
- ReferenceConfig <DubboService > reference = new ReferenceConfig <>();
100
- reference .setInterface (DubboService .class );
101
- reference .setRegistry (registryConfig );
102
- reference .setUrl (address );
103
- reference .setVersion ("1.0" );
104
- reference .setGroup ("tracer" );
105
- reference .setFilter ("dubboSofaTracerFilter" );
106
- reference .setApplication (config );
107
- reference .setAsync (true );
108
- DubboService service = reference .get ();
109
- Assert .assertEquals (service .echoStr ("sofa-tarcer" ), null );
110
- Object o = RpcContext .getContext ().getFuture ().get ();
111
- Assert .assertTrue (o .toString ().equalsIgnoreCase ("sofa-tarcer" ));
112
-
113
- Thread .sleep (500 );
114
- //wait for async output
115
- List <String > serverContent = FileUtils .readLines (new File (
116
- logDirectoryPath + File .separator
117
- + DubboLogEnum .DUBBO_SERVER_DIGEST .getDefaultLogName ()));
118
- Assert .assertTrue (serverContent .size () == 1 );
119
- String jsonData = serverContent .get (0 );
120
- JSONObject json = JSON .parseObject (jsonData );
121
- Assert .assertEquals (json .getString (CommonSpanTags .SERVICE ),
122
- "com.alipay.sofa.tracer.plugins.dubbo.service.DubboService" );
123
- Assert .assertEquals (json .getString (CommonSpanTags .LOCAL_APP ), "test-server" );
124
- Assert .assertEquals (json .getString ("spanId" ), "0" );
125
- Assert .assertEquals (json .getString (CommonSpanTags .METHOD ), "echoStr" );
126
- Assert .assertEquals (json .getString (CommonSpanTags .PROTOCOL ), "dubbo" );
127
- Assert .assertEquals (json .getString ("span.kind" ), "server" );
128
-
129
- //wait for async output
130
- List <String > clientContents = FileUtils .readLines (new File (
131
- logDirectoryPath + File .separator
132
- + DubboLogEnum .DUBBO_CLIENT_DIGEST .getDefaultLogName ()));
133
-
134
- Assert .assertTrue (clientContents .size () == 1 );
135
- String clientData = clientContents .get (0 );
136
- JSONObject clientJson = JSON .parseObject (clientData );
137
-
138
- Assert .assertEquals (clientJson .getString (CommonSpanTags .SERVICE ),
139
- "com.alipay.sofa.tracer.plugins.dubbo.service.DubboService" );
140
- Assert .assertEquals (clientJson .getString (CommonSpanTags .LOCAL_APP ), "test-server" );
141
- Assert .assertEquals (clientJson .getString ("spanId" ), "0" );
142
- Assert .assertEquals (clientJson .getString (CommonSpanTags .METHOD ), "echoStr" );
143
- Assert .assertEquals (clientJson .getString (CommonSpanTags .PROTOCOL ), "dubbo" );
144
- Assert .assertEquals (clientJson .getString ("span.kind" ), "client" );
145
-
146
- Thread .sleep (500 );
147
-
148
- //wait for async output
149
- List <String > clientStatContents = FileUtils
150
- .readLines (new File (logDirectoryPath + File .separator
151
- + DubboLogEnum .DUBBO_CLIENT_STAT .getDefaultLogName ()));
152
-
153
- Assert .assertTrue (clientStatContents .size () == 1 );
154
-
155
- //wait for async output
156
- List <String > serverStatContents = FileUtils
157
- .readLines (new File (logDirectoryPath + File .separator
158
- + DubboLogEnum .DUBBO_SERVER_STAT .getDefaultLogName ()));
159
-
160
- Assert .assertTrue (serverStatContents .size () == 1 );
161
-
162
- }
92
+ // @Test
93
+ // public void testTracer() throws Exception {
94
+ // RegistryConfig registryConfig = new RegistryConfig();
95
+ // ApplicationConfig config = new ApplicationConfig();
96
+ // config.setName("test-server");
97
+ // registryConfig.setAddress("N/A");
98
+ // //The service caller connects to the registry and sets the properties.
99
+ // ReferenceConfig<DubboService> reference = new ReferenceConfig<>();
100
+ // reference.setInterface(DubboService.class);
101
+ // reference.setRegistry(registryConfig);
102
+ // reference.setUrl(address);
103
+ // reference.setVersion("1.0");
104
+ // reference.setGroup("tracer");
105
+ // reference.setFilter("dubboSofaTracerFilter");
106
+ // reference.setApplication(config);
107
+ // reference.setAsync(true);
108
+ // DubboService service = reference.get();
109
+ // Assert.assertEquals(service.echoStr("sofa-tarcer"), null);
110
+ // Object o = RpcContext.getContext().getFuture().get();
111
+ // Assert.assertTrue(o.toString().equalsIgnoreCase("sofa-tarcer"));
112
+ //
113
+ // Thread.sleep(500);
114
+ // //wait for async output
115
+ // List<String> serverContent = FileUtils.readLines(new File(
116
+ // logDirectoryPath + File.separator
117
+ // + DubboLogEnum.DUBBO_SERVER_DIGEST.getDefaultLogName()));
118
+ // Assert.assertTrue(serverContent.size() == 1);
119
+ // String jsonData = serverContent.get(0);
120
+ // JSONObject json = JSON.parseObject(jsonData);
121
+ // Assert.assertEquals(json.getString(CommonSpanTags.SERVICE),
122
+ // "com.alipay.sofa.tracer.plugins.dubbo.service.DubboService");
123
+ // Assert.assertEquals(json.getString(CommonSpanTags.LOCAL_APP), "test-server");
124
+ // Assert.assertEquals(json.getString("spanId"), "0");
125
+ // Assert.assertEquals(json.getString(CommonSpanTags.METHOD), "echoStr");
126
+ // Assert.assertEquals(json.getString(CommonSpanTags.PROTOCOL), "dubbo");
127
+ // Assert.assertEquals(json.getString("span.kind"), "server");
128
+ //
129
+ // //wait for async output
130
+ // List<String> clientContents = FileUtils.readLines(new File(
131
+ // logDirectoryPath + File.separator
132
+ // + DubboLogEnum.DUBBO_CLIENT_DIGEST.getDefaultLogName()));
133
+ //
134
+ // Assert.assertTrue(clientContents.size() == 1);
135
+ // String clientData = clientContents.get(0);
136
+ // JSONObject clientJson = JSON.parseObject(clientData);
137
+ //
138
+ // Assert.assertEquals(clientJson.getString(CommonSpanTags.SERVICE),
139
+ // "com.alipay.sofa.tracer.plugins.dubbo.service.DubboService");
140
+ // Assert.assertEquals(clientJson.getString(CommonSpanTags.LOCAL_APP), "test-server");
141
+ // Assert.assertEquals(clientJson.getString("spanId"), "0");
142
+ // Assert.assertEquals(clientJson.getString(CommonSpanTags.METHOD), "echoStr");
143
+ // Assert.assertEquals(clientJson.getString(CommonSpanTags.PROTOCOL), "dubbo");
144
+ // Assert.assertEquals(clientJson.getString("span.kind"), "client");
145
+ //
146
+ // Thread.sleep(500);
147
+ //
148
+ // //wait for async output
149
+ // List<String> clientStatContents = FileUtils
150
+ // .readLines(new File(logDirectoryPath + File.separator
151
+ // + DubboLogEnum.DUBBO_CLIENT_STAT.getDefaultLogName()));
152
+ //
153
+ // Assert.assertTrue(clientStatContents.size() == 1);
154
+ //
155
+ // //wait for async output
156
+ // List<String> serverStatContents = FileUtils
157
+ // .readLines(new File(logDirectoryPath + File.separator
158
+ // + DubboLogEnum.DUBBO_SERVER_STAT.getDefaultLogName()));
159
+ //
160
+ // Assert.assertTrue(serverStatContents.size() == 1);
161
+ //
162
+ // }
163
163
164
164
private void cleanFile () {
165
165
DubboLogEnum [] dubboLogEnums = DubboLogEnum .values ();
0 commit comments