This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 212e7aa2694 Refactor E2E environment setup code. (#32425)
212e7aa2694 is described below
commit 212e7aa2694410b48f807a207dba8ecd6757f77d
Author: Cong Hu <[email protected]>
AuthorDate: Thu Aug 8 14:25:14 2024 +0800
Refactor E2E environment setup code. (#32425)
---
.../test/e2e/env/E2EEnvironmentSetupProcessor.java | 35 +---------------------
1 file changed, 1 insertion(+), 34 deletions(-)
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/E2EEnvironmentSetupProcessor.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/E2EEnvironmentSetupProcessor.java
index 3f7faa2b037..8aede5b9989 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/E2EEnvironmentSetupProcessor.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/E2EEnvironmentSetupProcessor.java
@@ -17,52 +17,19 @@
package org.apache.shardingsphere.test.e2e.env;
-import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
-import org.apache.shardingsphere.test.e2e.engine.arg.E2ETestCaseSettings;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.enums.AdapterMode;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.enums.AdapterType;
-import org.apache.shardingsphere.test.e2e.env.runtime.E2ETestEnvironment;
-import
org.apache.shardingsphere.test.e2e.framework.param.array.E2ETestParameterFactory;
import
org.apache.shardingsphere.test.e2e.framework.param.model.E2ETestParameter;
-import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.InvocationInterceptor;
import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
import java.lang.reflect.Method;
-public class E2EEnvironmentSetupProcessor implements BeforeAllCallback,
InvocationInterceptor {
-
- @Override
- public void beforeAll(final ExtensionContext context) {
- if (!E2ETestParameterFactory.containsTestParameter()) {
- return;
- }
- E2ETestEnvironment testEnvironment = E2ETestEnvironment.getInstance();
- E2ETestCaseSettings settings =
context.getRequiredTestClass().getAnnotation(E2ETestCaseSettings.class);
- for (String scenario : testEnvironment.getScenarios()) {
- for (DatabaseType databaseType :
testEnvironment.getClusterEnvironment().getDatabaseTypes()) {
- for (String adapterMode : testEnvironment.getRunModes()) {
- for (String adapterType :
testEnvironment.getClusterEnvironment().getAdapters()) {
- // todo Remove the key originating from the historical
code.
- String key = String.join("-",
settings.value().toString(), scenario, adapterType, databaseType.getType());
- new E2EEnvironmentEngine(key, scenario, databaseType,
AdapterMode.valueOf(adapterMode.toUpperCase()),
AdapterType.valueOf(adapterType.toUpperCase()));
- }
- }
- }
- }
- }
+public final class E2EEnvironmentSetupProcessor implements
InvocationInterceptor {
@Override
public void interceptTestTemplateMethod(final Invocation<Void> invocation,
final ReflectiveInvocationContext<Method> invocationContext, final
ExtensionContext extensionContext) throws Throwable {
- interceptTestMethod(invocation, invocationContext, extensionContext);
- }
-
- @Override
- public void interceptTestMethod(final Invocation<Void> invocation, final
ReflectiveInvocationContext<Method> invocationContext, final ExtensionContext
extensionContext) throws Throwable {
- if (!(extensionContext.getRequiredTestInstance() instanceof
E2EEnvironmentAware)) {
- throw new UnsupportedOperationException("E2EEnvironmentAware is
required.");
- }
for (Object each : invocationContext.getArguments()) {
if (each instanceof E2ETestParameter) {
E2ETestParameter testParameter = (E2ETestParameter) each;