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 41f9c1ba6d6 Add AgentE2ETestCase interface (#32193)
41f9c1ba6d6 is described below
commit 41f9c1ba6d6bb7573a2497783863c5651d7d5ad1
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Jul 20 11:40:05 2024 +0800
Add AgentE2ETestCase interface (#32193)
---
.../e2e/agent/common/cases/AgentE2ETestCase.java} | 25 +++-------------------
.../e2e/agent/file/cases/E2ETestCasesLoader.java | 7 +++---
.../test/e2e/agent/file/cases/LogTestCase.java | 3 ++-
.../agent/metrics/cases/E2ETestCasesLoader.java | 14 ++++++------
.../e2e/agent/metrics/cases/MetricTestCase.java | 3 ++-
.../e2e/agent/jaeger/cases/E2ETestCasesLoader.java | 5 +++--
.../test/e2e/agent/jaeger/cases/SpanTestCase.java | 3 ++-
.../e2e/agent/zipkin/cases/E2ETestCasesLoader.java | 5 +++--
.../test/e2e/agent/zipkin/cases/SpanTestCase.java | 3 ++-
9 files changed, 28 insertions(+), 40 deletions(-)
diff --git
a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/LogTestCase.java
b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/cases/AgentE2ETestCase.java
similarity index 55%
copy from
test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/LogTestCase.java
copy to
test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/cases/AgentE2ETestCase.java
index b6d9bb0a6c7..d414e9c7c20 100644
---
a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/LogTestCase.java
+++
b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/cases/AgentE2ETestCase.java
@@ -15,29 +15,10 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.e2e.agent.file.cases;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.test.e2e.agent.common.env.E2ETestEnvironment;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
+package org.apache.shardingsphere.test.e2e.agent.common.cases;
/**
- * Log test case.
+ * Agent E2E test cases.
*/
-@Getter
-@Setter
-@XmlAccessorType(XmlAccessType.FIELD)
-public final class LogTestCase {
-
- @XmlAttribute(name = "log-regex")
- private String logRegex;
-
- @Override
- public String toString() {
- return String.format("%s -> `%s`",
E2ETestEnvironment.getInstance().getAdapter(), logRegex);
- }
+public interface AgentE2ETestCase {
}
diff --git
a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/E2ETestCasesLoader.java
b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/E2ETestCasesLoader.java
index 0cef89352e9..3e678f4cedc 100644
---
a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/E2ETestCasesLoader.java
+++
b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/E2ETestCasesLoader.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.test.e2e.agent.file.cases;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
+import org.apache.shardingsphere.test.e2e.agent.common.cases.AgentE2ETestCase;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
@@ -48,7 +49,7 @@ public final class E2ETestCasesLoader {
private static final E2ETestCasesLoader INSTANCE = new
E2ETestCasesLoader();
- private Collection<LogTestCase> testCases;
+ private Collection<AgentE2ETestCase> testCases;
/**
* Get singleton instance.
@@ -62,11 +63,11 @@ public final class E2ETestCasesLoader {
/**
* Load test cases.
*
- * @param adapter adapter proxy or JDBC
+ * @param adapter adapter
* @return test cases
*/
@SneakyThrows({IOException.class, URISyntaxException.class,
JAXBException.class})
- public Collection<LogTestCase> loadTestCases(final String adapter) {
+ public Collection<AgentE2ETestCase> loadTestCases(final String adapter) {
if (null != testCases) {
return testCases;
}
diff --git
a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/LogTestCase.java
b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/LogTestCase.java
index b6d9bb0a6c7..d21de04e347 100644
---
a/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/LogTestCase.java
+++
b/test/e2e/agent/plugins/logging/file/src/test/java/org/apache/shardingsphere/test/e2e/agent/file/cases/LogTestCase.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.test.e2e.agent.file.cases;
import lombok.Getter;
import lombok.Setter;
+import org.apache.shardingsphere.test.e2e.agent.common.cases.AgentE2ETestCase;
import org.apache.shardingsphere.test.e2e.agent.common.env.E2ETestEnvironment;
import javax.xml.bind.annotation.XmlAccessType;
@@ -31,7 +32,7 @@ import javax.xml.bind.annotation.XmlAttribute;
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
-public final class LogTestCase {
+public final class LogTestCase implements AgentE2ETestCase {
@XmlAttribute(name = "log-regex")
private String logRegex;
diff --git
a/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/cases/E2ETestCasesLoader.java
b/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/cases/E2ETestCasesLoader.java
index 7c934c462fe..831ce963e05 100644
---
a/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/cases/E2ETestCasesLoader.java
+++
b/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/cases/E2ETestCasesLoader.java
@@ -20,6 +20,7 @@ package
org.apache.shardingsphere.test.e2e.agent.metrics.cases;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
+import org.apache.shardingsphere.test.e2e.agent.common.cases.AgentE2ETestCase;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
@@ -48,7 +49,7 @@ public final class E2ETestCasesLoader {
private static final E2ETestCasesLoader INSTANCE = new
E2ETestCasesLoader();
- private Collection<MetricTestCase> testCases;
+ private Collection<AgentE2ETestCase> testCases;
/**
* Get singleton instance.
@@ -62,18 +63,17 @@ public final class E2ETestCasesLoader {
/**
* Load test cases.
*
- * @param adapter adapter proxy or jdbc
+ * @param adapter adapter
* @return test cases
*/
@SneakyThrows({IOException.class, URISyntaxException.class,
JAXBException.class})
- public Collection<MetricTestCase> loadTestCases(final String adapter) {
+ public Collection<AgentE2ETestCase> loadTestCases(final String adapter) {
if (null != testCases) {
return testCases;
}
testCases = new LinkedList<>();
URL url =
Objects.requireNonNull(Thread.currentThread().getContextClassLoader().getResource(String.format("cases/%s",
adapter)));
- Collection<File> files = getFiles(url);
- for (File each : files) {
+ for (File each : getFiles(url)) {
testCases.addAll(unmarshal(each.getPath()).getTestCases());
}
return testCases;
@@ -94,8 +94,8 @@ public final class E2ETestCasesLoader {
return result;
}
- private E2ETestCases unmarshal(final String integrateCasesFile) throws
IOException, JAXBException {
- try (FileReader reader = new FileReader(integrateCasesFile)) {
+ private E2ETestCases unmarshal(final String e2eCasesFile) throws
IOException, JAXBException {
+ try (FileReader reader = new FileReader(e2eCasesFile)) {
return (E2ETestCases)
JAXBContext.newInstance(E2ETestCases.class).createUnmarshaller().unmarshal(reader);
}
}
diff --git
a/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/cases/MetricTestCase.java
b/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/cases/MetricTestCase.java
index 152f16c57eb..43d44e0a705 100644
---
a/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/cases/MetricTestCase.java
+++
b/test/e2e/agent/plugins/metrics/prometheus/src/test/java/org/apache/shardingsphere/test/e2e/agent/metrics/cases/MetricTestCase.java
@@ -19,6 +19,7 @@ package
org.apache.shardingsphere.test.e2e.agent.metrics.cases;
import lombok.Getter;
import lombok.Setter;
+import org.apache.shardingsphere.test.e2e.agent.common.cases.AgentE2ETestCase;
import org.apache.shardingsphere.test.e2e.agent.common.env.E2ETestEnvironment;
import javax.xml.bind.annotation.XmlAccessType;
@@ -34,7 +35,7 @@ import java.util.LinkedList;
@Getter
@Setter
@XmlAccessorType(XmlAccessType.FIELD)
-public final class MetricTestCase {
+public final class MetricTestCase implements AgentE2ETestCase {
@XmlAttribute(name = "metric-name")
private String metricName;
diff --git
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/E2ETestCasesLoader.java
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/E2ETestCasesLoader.java
index 5b6911731b2..343f8a3a61e 100644
---
a/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/E2ETestCasesLoader.java
+++
b/test/e2e/agent/plugins/tracing/jaeger/src/test/java/org/apache/shardingsphere/test/e2e/agent/jaeger/cases/E2ETestCasesLoader.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.test.e2e.agent.jaeger.cases;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
+import org.apache.shardingsphere.test.e2e.agent.common.cases.AgentE2ETestCase;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
@@ -48,7 +49,7 @@ public final class E2ETestCasesLoader {
private static final E2ETestCasesLoader INSTANCE = new
E2ETestCasesLoader();
- private Collection<SpanTestCase> testCases;
+ private Collection<AgentE2ETestCase> testCases;
/**
* Get singleton instance.
@@ -66,7 +67,7 @@ public final class E2ETestCasesLoader {
* @return test cases
*/
@SneakyThrows({IOException.class, URISyntaxException.class,
JAXBException.class})
- public Collection<SpanTestCase> loadTestCases(final String adapter) {
+ public Collection<AgentE2ETestCase> loadTestCases(final String adapter) {
if (null != testCases) {
return testCases;
}
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/SpanTestCase.java
index 8fcab62fa0c..cd6598caf0e 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/SpanTestCase.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.test.e2e.agent.jaeger.cases;
import lombok.Getter;
import lombok.Setter;
+import org.apache.shardingsphere.test.e2e.agent.common.cases.AgentE2ETestCase;
import org.apache.shardingsphere.test.e2e.agent.common.env.E2ETestEnvironment;
import javax.xml.bind.annotation.XmlAccessType;
@@ -33,7 +34,7 @@ import java.util.Collection;
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
-public final class SpanTestCase {
+public final class SpanTestCase implements AgentE2ETestCase {
@XmlAttribute(name = "service-name")
private String serviceName;
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/E2ETestCasesLoader.java
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/E2ETestCasesLoader.java
index 22de34377d9..67f93d8e2f6 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/E2ETestCasesLoader.java
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/E2ETestCasesLoader.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.test.e2e.agent.zipkin.cases;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
+import org.apache.shardingsphere.test.e2e.agent.common.cases.AgentE2ETestCase;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
@@ -48,7 +49,7 @@ public final class E2ETestCasesLoader {
private static final E2ETestCasesLoader INSTANCE = new
E2ETestCasesLoader();
- private Collection<SpanTestCase> testCases;
+ private Collection<AgentE2ETestCase> testCases;
/**
* Get singleton instance.
@@ -66,7 +67,7 @@ public final class E2ETestCasesLoader {
* @return test cases
*/
@SneakyThrows({IOException.class, URISyntaxException.class,
JAXBException.class})
- public Collection<SpanTestCase> loadTestCases(final String adapter) {
+ public Collection<AgentE2ETestCase> loadTestCases(final String adapter) {
if (null != testCases) {
return testCases;
}
diff --git
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/SpanTestCase.java
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/SpanTestCase.java
index 8a429b09bcd..30a12e06e6e 100644
---
a/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/SpanTestCase.java
+++
b/test/e2e/agent/plugins/tracing/zipkin/src/test/java/org/apache/shardingsphere/test/e2e/agent/zipkin/cases/SpanTestCase.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.test.e2e.agent.zipkin.cases;
import lombok.Getter;
import lombok.Setter;
+import org.apache.shardingsphere.test.e2e.agent.common.cases.AgentE2ETestCase;
import org.apache.shardingsphere.test.e2e.agent.common.env.E2ETestEnvironment;
import javax.xml.bind.annotation.XmlAccessType;
@@ -33,7 +34,7 @@ import java.util.Collection;
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
-public final class SpanTestCase {
+public final class SpanTestCase implements AgentE2ETestCase {
@XmlAttribute(name = "service-name")
private String serviceName;