This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new fb30473cd65 Refactor JaegerSpanAssert (#32205)
fb30473cd65 is described below

commit fb30473cd65ab24b2d1663a383e859053a15daaa
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Jul 20 20:56:03 2024 +0800

    Refactor JaegerSpanAssert (#32205)
    
    * Refactor JaegerSpanAssert
    
    * Refactor JaegerSpanAssert
---
 .../test/e2e/agent/common/util/HttpUtils.java      |  6 +-
 .../test/e2e/agent/file/FilePluginE2EIT.java       |  2 +-
 .../test/e2e/agent/metrics/MetricsPluginE2EIT.java |  4 +-
 .../test/e2e/agent/jaeger/JaegerPluginE2EIT.java   |  8 +-
 .../e2e/agent/jaeger/asserts/JaegerSpanAssert.java | 84 ++++++++++++++++++++
 .../test/e2e/agent/jaeger/asserts/SpanAssert.java  | 89 ----------------------
 .../response/JaegerSpanResponse.java}              | 29 ++++++-
 .../response/JaegerTraceResponse.java}             |  9 ++-
 .../response/JaegerTraceResponseData.java}         | 15 ++--
 .../{SpanTestCase.java => JaegerE2ETestCase.java}  | 10 +--
 .../e2e/agent/jaeger/cases/JaegerE2ETestCases.java |  4 +-
 .../{TagAssertion.java => JaegerTagAssertion.java} |  6 +-
 .../e2e/agent/jaeger/result/JaegerTraceResult.java | 87 ---------------------
 .../test/e2e/agent/jaeger/result/TagResult.java    | 32 --------
 .../src/test/resources/cases/jdbc/execute_sql.xml  | 18 ++---
 .../src/test/resources/cases/jdbc/parse_sql.xml    |  6 +-
 .../src/test/resources/cases/jdbc/root_invoke.xml  |  4 +-
 .../src/test/resources/cases/proxy/execute_sql.xml | 18 ++---
 .../src/test/resources/cases/proxy/parse_sql.xml   |  6 +-
 .../src/test/resources/cases/proxy/root_invoke.xml |  4 +-
 .../test/e2e/agent/zipkin/ZipkinPluginE2EIT.java   |  4 +-
 .../test/e2e/agent/zipkin/asserts/SpanAssert.java  |  2 +-
 22 files changed, 174 insertions(+), 273 deletions(-)

diff --git 
a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/util/HttpUtils.java
 
b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/util/HttpUtils.java
index ae99f6f785b..556cef048ee 100644
--- 
a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/util/HttpUtils.java
+++ 
b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/util/HttpUtils.java
@@ -49,13 +49,13 @@ public final class HttpUtils {
     }
     
     /**
-     * Get response.
+     * Query response.
      *
-     * @param url URL
+     * @param url query URL
      * @return response
      * @throws IOException IO exception
      */
-    public String get(final String url) throws IOException {
+    public String query(final String url) throws IOException {
         Request request = new Request.Builder().url(url).build();
         try (Response response = client.newCall(request).execute()) {
             assertNotNull(response.body());
diff --git 
a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java
 
b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java
index 95ace7e314d..ba0474e303e 100644
--- 
a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java
+++ 
b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/FilePluginE2EIT.java
@@ -36,7 +36,7 @@ class FilePluginE2EIT {
     @EnabledIf("isEnabled")
     @ParameterizedTest
     @ArgumentsSource(TestCaseArgumentsProvider.class)
-    void assertWithAgent(final LogE2ETestCase testCase) {
+    void assertLogAgent(final LogE2ETestCase testCase) {
         
assertFalse(AgentE2ETestEnvironment.getInstance().getActualLogs().isEmpty(), 
"The actual log is empty");
         
LogContentAssert.assertIs(AgentE2ETestEnvironment.getInstance().getActualLogs(),
 testCase.getLogRegex());
     }
diff --git 
a/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/MetricsPluginE2EIT.java
 
b/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/MetricsPluginE2EIT.java
index 8a531bac113..1ef307a4dc1 100644
--- 
a/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/MetricsPluginE2EIT.java
+++ 
b/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/MetricsPluginE2EIT.java
@@ -58,7 +58,7 @@ class MetricsPluginE2EIT {
                 : metricCase.getMetricName();
         try {
             String metaDataURLWithParam = String.join("", metaDataURL, 
"?metric=", URLEncoder.encode(metricName, "UTF-8"));
-            
MetricMetadataAssert.assertIs(JsonUtils.fromJsonString(HttpUtils.getInstance().get(metaDataURLWithParam),
 MetricsMetaDataResult.class), metricCase);
+            
MetricMetadataAssert.assertIs(JsonUtils.fromJsonString(HttpUtils.getInstance().query(metaDataURLWithParam),
 MetricsMetaDataResult.class), metricCase);
         } catch (final IOException ex) {
             log.info("Access prometheus HTTP RESTFul API error: ", ex);
         }
@@ -68,7 +68,7 @@ class MetricsPluginE2EIT {
         for (MetricQueryAssertion each : metricCase.getQueryAssertions()) {
             try {
                 String queryURLWithParam = String.join("", queryURL, 
"?query=", URLEncoder.encode(each.getQuery(), "UTF-8"));
-                
MetricQueryAssert.assertIs(JsonUtils.fromJsonString(HttpUtils.getInstance().get(queryURLWithParam),
 MetricsQueryResult.class), each);
+                
MetricQueryAssert.assertIs(JsonUtils.fromJsonString(HttpUtils.getInstance().query(queryURLWithParam),
 MetricsQueryResult.class), each);
             } catch (final IOException ex) {
                 log.info("Access prometheus HTTP RESTFul API error: ", ex);
             }
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/JaegerPluginE2EIT.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/JaegerPluginE2EIT.java
index 719a3fe1758..516837e4d68 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/JaegerPluginE2EIT.java
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/JaegerPluginE2EIT.java
@@ -20,9 +20,9 @@ package org.apache.shardingsphere.test.e2e.agent.jaeger;
 import 
org.apache.shardingsphere.test.e2e.agent.common.env.AgentE2ETestEnvironment;
 import 
org.apache.shardingsphere.test.e2e.agent.common.framework.AgentE2ETestActionExtension;
 import 
org.apache.shardingsphere.test.e2e.agent.common.framework.AgentE2ETestCaseArgumentsProvider;
-import org.apache.shardingsphere.test.e2e.agent.jaeger.asserts.SpanAssert;
+import 
org.apache.shardingsphere.test.e2e.agent.jaeger.asserts.JaegerSpanAssert;
 import 
org.apache.shardingsphere.test.e2e.agent.jaeger.cases.JaegerE2ETestCases;
-import org.apache.shardingsphere.test.e2e.agent.jaeger.cases.SpanTestCase;
+import org.apache.shardingsphere.test.e2e.agent.jaeger.cases.JaegerE2ETestCase;
 import org.junit.jupiter.api.condition.EnabledIf;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.junit.jupiter.params.ParameterizedTest;
@@ -34,8 +34,8 @@ class JaegerPluginE2EIT {
     @EnabledIf("isEnabled")
     @ParameterizedTest
     @ArgumentsSource(TestCaseArgumentsProvider.class)
-    void assertWithAgent(final SpanTestCase spanTestCase) {
-        
SpanAssert.assertIs(AgentE2ETestEnvironment.getInstance().getJaegerHttpUrl(), 
spanTestCase);
+    void assertTraceAgent(final JaegerE2ETestCase testCase) {
+        
JaegerSpanAssert.assertIs(AgentE2ETestEnvironment.getInstance().getJaegerHttpUrl(),
 testCase);
     }
     
     private static boolean isEnabled() {
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/JaegerSpanAssert.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/JaegerSpanAssert.java
new file mode 100644
index 00000000000..a87d04a81b1
--- /dev/null
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/JaegerSpanAssert.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.e2e.agent.jaeger.asserts;
+
+import com.google.common.collect.ImmutableMap;
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.infra.util.json.JsonUtils;
+import org.apache.shardingsphere.test.e2e.agent.common.util.HttpUtils;
+import 
org.apache.shardingsphere.test.e2e.agent.jaeger.asserts.response.JaegerSpanResponse;
+import 
org.apache.shardingsphere.test.e2e.agent.jaeger.asserts.response.JaegerSpanResponse.Tag;
+import 
org.apache.shardingsphere.test.e2e.agent.jaeger.asserts.response.JaegerTraceResponse;
+import 
org.apache.shardingsphere.test.e2e.agent.jaeger.asserts.response.JaegerTraceResponseData;
+import org.apache.shardingsphere.test.e2e.agent.jaeger.cases.JaegerE2ETestCase;
+import 
org.apache.shardingsphere.test.e2e.agent.jaeger.cases.JaegerTagAssertion;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.Collection;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Jaeger Span assert.
+ */
+public final class JaegerSpanAssert {
+    
+    /**
+     * Assert jaeger span.
+     *
+     * @param jaegerUrl jaeger query URL
+     * @param expected expected test case
+     */
+    public static void assertIs(final String jaegerUrl, final 
JaegerE2ETestCase expected) {
+        assertTagKey(jaegerUrl, expected);
+        
expected.getTags().stream().filter(JaegerTagAssertion::isNeedAssertValue).forEach(each
 -> assertTagValue(jaegerUrl, expected, each));
+    }
+    
+    private static void assertTagKey(final String jaegerUrl, final 
JaegerE2ETestCase expected) {
+        String queryURL = 
String.format("%s/api/traces?service=%s&operation=%s&limit=%s", jaegerUrl, 
encode(expected.getServiceName()), encode(expected.getSpanName()), 1000);
+        Optional<JaegerSpanResponse> spanResponse = 
queryTraceResponses(queryURL).stream().flatMap(each -> each.getSpans().stream())
+                .filter(each -> 
expected.getSpanName().equalsIgnoreCase(each.getOperationName())).findFirst();
+        assertTrue(spanResponse.isPresent());
+        Collection<String> actualTags = 
spanResponse.get().getTags().stream().map(Tag::getKey).collect(Collectors.toSet());
+        Collection<String> expectedTags = 
expected.getTags().stream().map(JaegerTagAssertion::getTagKey).collect(Collectors.toSet());
+        Collection<String> nonExistentTags = expectedTags.stream().filter(each 
-> !actualTags.contains(each)).collect(Collectors.toSet());
+        assertTrue(nonExistentTags.isEmpty(), String.format("The tags `%s` 
does not exist in `%s` span", nonExistentTags, expected.getSpanName()));
+    }
+    
+    private static void assertTagValue(final String jaegerUrl, final 
JaegerE2ETestCase expected, final JaegerTagAssertion expectedTagCase) {
+        String queryURL = 
String.format("%s/api/traces?service=%s&operation=%s&tags=%s&limit=%s", 
jaegerUrl, encode(expected.getServiceName()),
+                encode(expected.getSpanName()), 
encode(JsonUtils.toJsonString(ImmutableMap.of(expectedTagCase.getTagKey(), 
expectedTagCase.getTagValue()))), 1000);
+        assertFalse(queryTraceResponses(queryURL).isEmpty(),
+                String.format("The tag `%s`=`%s` does not exist in `%s` span", 
expectedTagCase.getTagKey(), expectedTagCase.getTagValue(), 
expected.getSpanName()));
+    }
+    
+    @SneakyThrows(UnsupportedEncodingException.class)
+    private static String encode(final String value) {
+        return URLEncoder.encode(value, "UTF-8");
+    }
+    
+    @SneakyThrows(IOException.class)
+    private static Collection<JaegerTraceResponseData> 
queryTraceResponses(final String queryURL) {
+        return 
JsonUtils.fromJsonString(HttpUtils.getInstance().query(queryURL), 
JaegerTraceResponse.class).getData();
+    }
+}
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/SpanAssert.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/SpanAssert.java
deleted file mode 100644
index b8b6a39e563..00000000000
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/SpanAssert.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.e2e.agent.jaeger.asserts;
-
-import com.google.common.collect.ImmutableMap;
-import lombok.SneakyThrows;
-import org.apache.shardingsphere.infra.util.json.JsonUtils;
-import org.apache.shardingsphere.test.e2e.agent.common.util.HttpUtils;
-import org.apache.shardingsphere.test.e2e.agent.jaeger.cases.SpanTestCase;
-import org.apache.shardingsphere.test.e2e.agent.jaeger.cases.TagAssertion;
-import org.apache.shardingsphere.test.e2e.agent.jaeger.result.SpanResult;
-import org.apache.shardingsphere.test.e2e.agent.jaeger.result.TagResult;
-import org.apache.shardingsphere.test.e2e.agent.jaeger.result.TraceResult;
-import org.apache.shardingsphere.test.e2e.agent.jaeger.result.TraceResults;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Collection;
-import java.util.stream.Collectors;
-
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * Span assert.
- */
-public final class SpanAssert {
-    
-    /**
-     * Assert span is correct with expected result.
-     *
-     * @param baseUrl jaeger query url
-     * @param expected expected span
-     */
-    public static void assertIs(final String baseUrl, final SpanTestCase 
expected) {
-        assertTagKey(baseUrl, expected);
-        
expected.getTagCases().stream().filter(TagAssertion::isNeedAssertValue).forEach(each
 -> assertTagValue(baseUrl, expected, each));
-    }
-    
-    private static void assertTagKey(final String baseUrl, final SpanTestCase 
expected) {
-        String urlWithParameter = 
String.format("%s/api/traces?service=%s&operation=%s&limit=%s", baseUrl,
-                getEncodeValue(expected.getServiceName()), 
getEncodeValue(expected.getSpanName()), 1000);
-        Collection<TraceResult> traceResults = 
getTraceResults(urlWithParameter);
-        assertNotNull(traceResults);
-        SpanResult spanResult = traceResults.stream().flatMap(each -> 
each.getSpans().stream())
-                .filter(each -> 
expected.getSpanName().equalsIgnoreCase(each.getOperationName())).findFirst().orElse(null);
-        assertNotNull(spanResult);
-        Collection<String> actualTags = 
spanResult.getTags().stream().map(TagResult::getKey).collect(Collectors.toSet());
-        Collection<String> expectedTags = 
expected.getTagCases().stream().map(TagAssertion::getTagKey).collect(Collectors.toSet());
-        Collection<String> nonExistentTags = expectedTags.stream().filter(each 
-> !actualTags.contains(each)).collect(Collectors.toSet());
-        assertTrue(nonExistentTags.isEmpty(), String.format("The tags `%s` 
does not exist in `%s` span", nonExistentTags, expected.getSpanName()));
-    }
-    
-    private static void assertTagValue(final String baseUrl, final 
SpanTestCase expected, final TagAssertion expectedTagCase) {
-        String urlWithParameter = 
String.format("%s/api/traces?service=%s&operation=%s&tags=%s&limit=%s", 
baseUrl, getEncodeValue(expected.getServiceName()),
-                getEncodeValue(expected.getSpanName()), 
getEncodeValue(JsonUtils.toJsonString(ImmutableMap.of(expectedTagCase.getTagKey(),
 expectedTagCase.getTagValue()))), 1000);
-        Collection<TraceResult> traceResults = 
getTraceResults(urlWithParameter);
-        assertFalse(traceResults.isEmpty(), String.format("The tag `%s`=`%s` 
does not exist in `%s` span", expectedTagCase.getTagKey(), 
expectedTagCase.getTagValue(), expected.getSpanName()));
-    }
-    
-    @SneakyThrows(UnsupportedEncodingException.class)
-    private static String getEncodeValue(final String value) {
-        return URLEncoder.encode(value, "UTF-8");
-    }
-    
-    @SneakyThrows(IOException.class)
-    private static Collection<TraceResult> getTraceResults(final String url) {
-        TraceResults result = 
JsonUtils.fromJsonString(HttpUtils.getInstance().get(url), TraceResults.class);
-        assertNotNull(result);
-        return result.getData();
-    }
-}
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/TraceResult.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/response/JaegerSpanResponse.java
similarity index 61%
rename from 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/TraceResult.java
rename to 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/response/JaegerSpanResponse.java
index ecf56585724..e549ae3b44a 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/TraceResult.java
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/response/JaegerSpanResponse.java
@@ -15,20 +15,43 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.test.e2e.agent.jaeger.result;
+package org.apache.shardingsphere.test.e2e.agent.jaeger.asserts.response;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Getter;
 import lombok.Setter;
+import org.apache.shardingsphere.infra.util.json.JsonConfiguration;
 
 import java.util.Collection;
 
+/**
+ * Jaeger span response.
+ */
 @Getter
 @Setter
-public final class TraceResult {
+public final class JaegerSpanResponse implements JsonConfiguration {
     
     @JsonProperty("traceID")
     private String traceId;
     
-    private Collection<SpanResult> spans;
+    @JsonProperty("spanID")
+    private String spanId;
+    
+    private String operationName;
+    
+    private Collection<Tag> tags;
+    
+    /**
+     * Jaeger tag response.
+     */
+    @Getter
+    @Setter
+    public static final class Tag implements JsonConfiguration {
+        
+        private String key;
+        
+        private String type;
+        
+        private String value;
+    }
 }
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/TraceResults.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/response/JaegerTraceResponse.java
similarity index 80%
rename from 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/TraceResults.java
rename to 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/response/JaegerTraceResponse.java
index fae94adc46c..1f0bfca951e 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/TraceResults.java
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/response/JaegerTraceResponse.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.test.e2e.agent.jaeger.result;
+package org.apache.shardingsphere.test.e2e.agent.jaeger.asserts.response;
 
 import lombok.Getter;
 import lombok.Setter;
@@ -23,9 +23,12 @@ import 
org.apache.shardingsphere.infra.util.json.JsonConfiguration;
 
 import java.util.Collection;
 
+/**
+ * Jaeger trace response.
+ */
 @Getter
 @Setter
-public final class TraceResults implements JsonConfiguration {
+public final class JaegerTraceResponse implements JsonConfiguration {
     
-    private Collection<TraceResult> data;
+    private Collection<JaegerTraceResponseData> data;
 }
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/SpanResult.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/response/JaegerTraceResponseData.java
similarity index 76%
rename from 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/SpanResult.java
rename to 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/response/JaegerTraceResponseData.java
index 099a8d84e5c..496baef7ed9 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/SpanResult.java
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/asserts/response/JaegerTraceResponseData.java
@@ -15,25 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.test.e2e.agent.jaeger.result;
+package org.apache.shardingsphere.test.e2e.agent.jaeger.asserts.response;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Getter;
 import lombok.Setter;
+import org.apache.shardingsphere.infra.util.json.JsonConfiguration;
 
 import java.util.Collection;
 
+/**
+ * Jaeger trace response data.
+ */
 @Getter
 @Setter
-public final class SpanResult {
+public final class JaegerTraceResponseData implements JsonConfiguration {
     
     @JsonProperty("traceID")
     private String traceId;
     
-    @JsonProperty("spanID")
-    private String spanId;
-    
-    private String operationName;
-    
-    private Collection<TagResult> tags;
+    private Collection<JaegerSpanResponse> spans;
 }
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/SpanTestCase.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerE2ETestCase.java
similarity index 86%
rename from 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/SpanTestCase.java
rename to 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerE2ETestCase.java
index 8273c3895bb..f2e8f9b9d0f 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/SpanTestCase.java
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerE2ETestCase.java
@@ -29,12 +29,12 @@ import javax.xml.bind.annotation.XmlElement;
 import java.util.Collection;
 
 /**
- * Span test case.
+ * Jaeger E2E test case.
  */
 @XmlAccessorType(XmlAccessType.FIELD)
 @Getter
 @Setter
-public final class SpanTestCase implements AgentE2ETestCase {
+public final class JaegerE2ETestCase implements AgentE2ETestCase {
     
     @XmlAttribute(name = "service-name")
     private String serviceName;
@@ -42,11 +42,11 @@ public final class SpanTestCase implements AgentE2ETestCase 
{
     @XmlAttribute(name = "span-name")
     private String spanName;
     
-    @XmlElement(name = "tag-assertion")
-    private Collection<TagAssertion> tagCases;
+    @XmlElement(name = "tag")
+    private Collection<JaegerTagAssertion> tags;
     
     @Override
     public String toString() {
-        return String.format("%s -> %s -> %s", 
AgentE2ETestEnvironment.getInstance().getAdapter(), spanName, 
tagCases.iterator().next().toString());
+        return String.format("%s -> %s -> %s", 
AgentE2ETestEnvironment.getInstance().getAdapter(), spanName, 
tags.iterator().next().toString());
     }
 }
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerE2ETestCases.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerE2ETestCases.java
index 2e8afc39190..d45740ac323 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerE2ETestCases.java
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerE2ETestCases.java
@@ -30,8 +30,8 @@ import java.util.LinkedList;
  */
 @XmlRootElement(name = "e2e-test-cases")
 @Getter
-public final class JaegerE2ETestCases implements 
AgentE2ETestCases<SpanTestCase> {
+public final class JaegerE2ETestCases implements 
AgentE2ETestCases<JaegerE2ETestCase> {
     
     @XmlElement(name = "test-case")
-    private final Collection<SpanTestCase> testCases = new LinkedList<>();
+    private final Collection<JaegerE2ETestCase> testCases = new LinkedList<>();
 }
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/TagAssertion.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerTagAssertion.java
similarity index 95%
rename from 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/TagAssertion.java
rename to 
test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerTagAssertion.java
index ef0c6703b39..b4527319f99 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/TagAssertion.java
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/JaegerTagAssertion.java
@@ -25,12 +25,12 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
 
 /**
- * Tag assertion.
+ * Jaeger tag assertion.
  */
+@XmlAccessorType(XmlAccessType.FIELD)
 @Getter
 @Setter
-@XmlAccessorType(XmlAccessType.FIELD)
-public final class TagAssertion {
+public final class JaegerTagAssertion {
     
     @XmlAttribute(name = "key")
     private String tagKey;
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/JaegerTraceResult.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/JaegerTraceResult.java
deleted file mode 100644
index b822eb75217..00000000000
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/JaegerTraceResult.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.e2e.agent.jaeger.result;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.infra.util.json.JsonConfiguration;
-
-import java.util.List;
-
-/**
- * Jaeger trace result.
- */
-@Getter
-@Setter
-public final class JaegerTraceResult implements JsonConfiguration {
-    
-    private List<JaegerTraceResultData> data;
-    
-    private int total;
-    
-    private int limit;
-    
-    private int offset;
-    
-    private String errors;
-    
-    @Getter
-    @Setter
-    public static final class JaegerTraceResultData {
-        
-        @JsonProperty("traceID")
-        private String traceId;
-        
-        private List<Object> spans;
-        
-        private Object processes;
-        
-        private String warnings;
-    }
-    
-    @Getter
-    @Setter
-    public static final class Span {
-        
-        @JsonProperty("traceID")
-        private String traceId;
-        
-        @JsonProperty("spanID")
-        private String spanId;
-        
-        private int flags;
-        
-        private String operationName;
-        
-        private List<String> references;
-        
-        private long startTime;
-        
-        private int duration;
-        
-        private List<Object> tags;
-        
-        private List<String> logs;
-        
-        @JsonProperty("processID")
-        private String processId;
-        
-        private String warnings;
-    }
-}
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/TagResult.java
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/TagResult.java
deleted file mode 100644
index b994f9b1f16..00000000000
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/result/TagResult.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.e2e.agent.jaeger.result;
-
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public final class TagResult {
-    
-    private String key;
-    
-    private String type;
-    
-    private String value;
-}
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/execute_sql.xml
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/execute_sql.xml
index dd66b8496a8..3b4e29aea87 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/execute_sql.xml
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/execute_sql.xml
@@ -18,14 +18,14 @@
 
 <e2e-test-cases>
     <test-case service-name="shardingsphere" 
span-name="/ShardingSphere/executeSQL/">
-        <tag-assertion key="component" value="ShardingSphere"/>
-        <tag-assertion key="span.kind" value="client"/>
-        <tag-assertion key="db.type" value="MySQL"/>
-        <tag-assertion key="peer.hostname" value="mysql.host"/>
-        <tag-assertion key="peer.port" value="3306"/>
-        <tag-assertion key="db.instance" value="ds_0"/>
-        <tag-assertion key="db.instance" value="ds_1"/>
-        <tag-assertion key="db.bind_vars"  need-assert-value="false" />
-        <tag-assertion key="db.statement"  need-assert-value="false" />
+        <tag key="component" value="ShardingSphere" />
+        <tag key="span.kind" value="client" />
+        <tag key="db.type" value="MySQL" />
+        <tag key="peer.hostname" value="mysql.host" />
+        <tag key="peer.port" value="3306" />
+        <tag key="db.instance" value="ds_0" />
+        <tag key="db.instance" value="ds_1" />
+        <tag key="db.bind_vars" need-assert-value="false" />
+        <tag key="db.statement" need-assert-value="false" />
     </test-case>
 </e2e-test-cases>
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
index d25546ce4c4..1c19720aca0 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/parse_sql.xml
@@ -18,8 +18,8 @@
 
 <e2e-test-cases>
     <test-case service-name="shardingsphere" 
span-name="/ShardingSphere/parseSQL/">
-        <tag-assertion key="component" value="ShardingSphere"/>
-        <tag-assertion key="span.kind" value="internal"/>
-        <tag-assertion key="db.statement" value="SELECT * FROM t_order"/>
+        <tag key="component" value="ShardingSphere" />
+        <tag key="span.kind" value="internal" />
+        <tag key="db.statement" value="SELECT * FROM t_order" />
     </test-case>
 </e2e-test-cases>
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/root_invoke.xml
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/root_invoke.xml
index 4296b427b3e..2d5345dd1e7 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/root_invoke.xml
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/jdbc/root_invoke.xml
@@ -18,7 +18,7 @@
 
 <e2e-test-cases>
     <test-case service-name="shardingsphere" 
span-name="/ShardingSphere/rootInvoke/">
-        <tag-assertion key="component" value="ShardingSphere"/>
-        <tag-assertion key="span.kind" value="client"/>
+        <tag key="component" value="ShardingSphere" />
+        <tag key="span.kind" value="client" />
     </test-case>
 </e2e-test-cases>
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/execute_sql.xml
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/execute_sql.xml
index dd66b8496a8..3b4e29aea87 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/execute_sql.xml
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/execute_sql.xml
@@ -18,14 +18,14 @@
 
 <e2e-test-cases>
     <test-case service-name="shardingsphere" 
span-name="/ShardingSphere/executeSQL/">
-        <tag-assertion key="component" value="ShardingSphere"/>
-        <tag-assertion key="span.kind" value="client"/>
-        <tag-assertion key="db.type" value="MySQL"/>
-        <tag-assertion key="peer.hostname" value="mysql.host"/>
-        <tag-assertion key="peer.port" value="3306"/>
-        <tag-assertion key="db.instance" value="ds_0"/>
-        <tag-assertion key="db.instance" value="ds_1"/>
-        <tag-assertion key="db.bind_vars"  need-assert-value="false" />
-        <tag-assertion key="db.statement"  need-assert-value="false" />
+        <tag key="component" value="ShardingSphere" />
+        <tag key="span.kind" value="client" />
+        <tag key="db.type" value="MySQL" />
+        <tag key="peer.hostname" value="mysql.host" />
+        <tag key="peer.port" value="3306" />
+        <tag key="db.instance" value="ds_0" />
+        <tag key="db.instance" value="ds_1" />
+        <tag key="db.bind_vars" need-assert-value="false" />
+        <tag key="db.statement" need-assert-value="false" />
     </test-case>
 </e2e-test-cases>
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/parse_sql.xml
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/parse_sql.xml
index d25546ce4c4..1c19720aca0 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/parse_sql.xml
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/parse_sql.xml
@@ -18,8 +18,8 @@
 
 <e2e-test-cases>
     <test-case service-name="shardingsphere" 
span-name="/ShardingSphere/parseSQL/">
-        <tag-assertion key="component" value="ShardingSphere"/>
-        <tag-assertion key="span.kind" value="internal"/>
-        <tag-assertion key="db.statement" value="SELECT * FROM t_order"/>
+        <tag key="component" value="ShardingSphere" />
+        <tag key="span.kind" value="internal" />
+        <tag key="db.statement" value="SELECT * FROM t_order" />
     </test-case>
 </e2e-test-cases>
diff --git 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/root_invoke.xml
 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/root_invoke.xml
index 4296b427b3e..2d5345dd1e7 100644
--- 
a/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/root_invoke.xml
+++ 
b/test/e2e/agent/plugins/tracing/jaeger/src/test/resources/cases/proxy/root_invoke.xml
@@ -18,7 +18,7 @@
 
 <e2e-test-cases>
     <test-case service-name="shardingsphere" 
span-name="/ShardingSphere/rootInvoke/">
-        <tag-assertion key="component" value="ShardingSphere"/>
-        <tag-assertion key="span.kind" value="client"/>
+        <tag key="component" value="ShardingSphere" />
+        <tag key="span.kind" value="client" />
     </test-case>
 </e2e-test-cases>
diff --git 
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/ZipkinPluginE2EIT.java
 
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/ZipkinPluginE2EIT.java
index aba00c66880..6ba2572a15a 100644
--- 
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/ZipkinPluginE2EIT.java
+++ 
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/ZipkinPluginE2EIT.java
@@ -34,8 +34,8 @@ class ZipkinPluginE2EIT {
     @EnabledIf("isEnabled")
     @ParameterizedTest
     @ArgumentsSource(TestCaseArgumentsProvider.class)
-    void assertWithAgent(final SpanTestCase spanTestCase) {
-        
SpanAssert.assertIs(AgentE2ETestEnvironment.getInstance().getZipKinHttpUrl(), 
spanTestCase);
+    void assertTraceAgent(final SpanTestCase testCase) {
+        
SpanAssert.assertIs(AgentE2ETestEnvironment.getInstance().getZipKinHttpUrl(), 
testCase);
     }
     
     private static boolean isEnabled() {
diff --git 
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/asserts/SpanAssert.java
 
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/asserts/SpanAssert.java
index cfd75eddc69..c146129b709 100644
--- 
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/asserts/SpanAssert.java
+++ 
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/asserts/SpanAssert.java
@@ -77,7 +77,7 @@ public final class SpanAssert {
     
     @SneakyThrows(IOException.class)
     private static Collection<SpanResult> getSpanResults(final SpanTestCase 
expected, final String url) {
-        List<List<SpanResult>> result = 
JsonUtils.fromJsonString(HttpUtils.getInstance().get(url), new 
TypeReference<List<List<SpanResult>>>() {
+        List<List<SpanResult>> result = 
JsonUtils.fromJsonString(HttpUtils.getInstance().query(url), new 
TypeReference<List<List<SpanResult>>>() {
         });
         assertNotNull(result);
         return 
result.stream().findFirst().orElse(Collections.emptyList()).stream()


Reply via email to