You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/12/03 02:36:51 UTC
[shardingsphere] branch master updated: Remove SPI of ParallelRunnerExecutorKeyProvider (#22612)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 72941196ddc Remove SPI of ParallelRunnerExecutorKeyProvider (#22612)
72941196ddc is described below
commit 72941196ddc8d5b69af9ce61b69479305c44be20
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Dec 3 10:36:44 2022 +0800
Remove SPI of ParallelRunnerExecutorKeyProvider (#22612)
---
.../param/model/ITParameterizedArray.java | 11 ++++++--
.../key/ParallelRunnerExecutorKeyProvider.java | 4 +--
.../ParallelRunnerExecutorKeyProviderFactory.java | 23 +++++++--------
.../CaseParallelRunnerExecutorKeyProvider.java | 7 +++--
.../ScenarioParallelRunnerExecutorKeyProvider.java | 9 +++---
.../framework/runner/param/ParameterizedArray.java | 33 ----------------------
.../framework/runner/param/RunnerParameters.java | 5 ++--
....executor.key.ParallelRunnerExecutorKeyProvider | 19 -------------
8 files changed, 32 insertions(+), 79 deletions(-)
diff --git a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/ITParameterizedArray.java b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/ITParameterizedArray.java
index 8d359853872..094ef6b471a 100644
--- a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/ITParameterizedArray.java
+++ b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/param/model/ITParameterizedArray.java
@@ -17,13 +17,13 @@
package org.apache.shardingsphere.test.integration.framework.param.model;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.test.integration.cases.IntegrationTestCaseContext;
-import org.apache.shardingsphere.test.integration.framework.runner.param.ParameterizedArray;
/**
* IT parameterized array.
*/
-public interface ITParameterizedArray extends ParameterizedArray {
+public interface ITParameterizedArray {
/**
* Get test case context.
@@ -32,6 +32,13 @@ public interface ITParameterizedArray extends ParameterizedArray {
*/
IntegrationTestCaseContext getTestCaseContext();
+ /**
+ * Get database type.
+ *
+ * @return database type
+ */
+ DatabaseType getDatabaseType();
+
/**
* Get scenario.
*
diff --git a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ParallelRunnerExecutorKeyProvider.java b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ParallelRunnerExecutorKeyProvider.java
index 9af418deb16..b2c74831983 100644
--- a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ParallelRunnerExecutorKeyProvider.java
+++ b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ParallelRunnerExecutorKeyProvider.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.test.integration.framework.runner.executor.key;
+import org.apache.shardingsphere.test.integration.framework.param.model.ITParameterizedArray;
import org.apache.shardingsphere.test.integration.framework.runner.ParallelRunningStrategy.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.param.ParameterizedArray;
/**
* Parallel runner executor key provider.
@@ -31,7 +31,7 @@ public interface ParallelRunnerExecutorKeyProvider {
* @param parameterizedArray parameterized array
* @return parallel runner executor key
*/
- String getKey(ParameterizedArray parameterizedArray);
+ String getKey(ITParameterizedArray parameterizedArray);
/**
* Get parallel level.
diff --git a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ParallelRunnerExecutorKeyProviderFactory.java b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ParallelRunnerExecutorKeyProviderFactory.java
index a5f5167406d..0f16bf7a9a5 100644
--- a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ParallelRunnerExecutorKeyProviderFactory.java
+++ b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ParallelRunnerExecutorKeyProviderFactory.java
@@ -20,10 +20,8 @@ package org.apache.shardingsphere.test.integration.framework.runner.executor.key
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.test.integration.framework.runner.ParallelRunningStrategy.ParallelLevel;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.ServiceLoader;
+import org.apache.shardingsphere.test.integration.framework.runner.executor.key.impl.CaseParallelRunnerExecutorKeyProvider;
+import org.apache.shardingsphere.test.integration.framework.runner.executor.key.impl.ScenarioParallelRunnerExecutorKeyProvider;
/**
* Parallel runner executor key provider factory.
@@ -31,14 +29,6 @@ import java.util.ServiceLoader;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ParallelRunnerExecutorKeyProviderFactory {
- private static final Map<ParallelLevel, ParallelRunnerExecutorKeyProvider> PROVIDERS = new HashMap<>();
-
- static {
- for (ParallelRunnerExecutorKeyProvider each : ServiceLoader.load(ParallelRunnerExecutorKeyProvider.class)) {
- PROVIDERS.put(each.getParallelLevel(), each);
- }
- }
-
/**
* Create new instance of parallel runner executor key provider.
*
@@ -46,6 +36,13 @@ public final class ParallelRunnerExecutorKeyProviderFactory {
* @return created instance
*/
public static ParallelRunnerExecutorKeyProvider newInstance(final ParallelLevel parallelLevel) {
- return PROVIDERS.get(parallelLevel);
+ switch (parallelLevel) {
+ case CASE:
+ return new CaseParallelRunnerExecutorKeyProvider();
+ case SCENARIO:
+ return new ScenarioParallelRunnerExecutorKeyProvider();
+ default:
+ throw new UnsupportedOperationException(parallelLevel.name());
+ }
}
}
diff --git a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/CaseParallelRunnerExecutorKeyProvider.java b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/impl/CaseParallelRunnerExecutorKeyProvider.java
similarity index 85%
rename from test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/CaseParallelRunnerExecutorKeyProvider.java
rename to test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/impl/CaseParallelRunnerExecutorKeyProvider.java
index 472d15a3a63..a8830164264 100644
--- a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/CaseParallelRunnerExecutorKeyProvider.java
+++ b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/impl/CaseParallelRunnerExecutorKeyProvider.java
@@ -15,10 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.framework.runner.executor.key;
+package org.apache.shardingsphere.test.integration.framework.runner.executor.key.impl;
+import org.apache.shardingsphere.test.integration.framework.param.model.ITParameterizedArray;
import org.apache.shardingsphere.test.integration.framework.runner.ParallelRunningStrategy.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.param.ParameterizedArray;
+import org.apache.shardingsphere.test.integration.framework.runner.executor.key.ParallelRunnerExecutorKeyProvider;
/**
* Case parallel runner executor key provider.
@@ -26,7 +27,7 @@ import org.apache.shardingsphere.test.integration.framework.runner.param.Paramet
public final class CaseParallelRunnerExecutorKeyProvider implements ParallelRunnerExecutorKeyProvider {
@Override
- public String getKey(final ParameterizedArray parameterizedArray) {
+ public String getKey(final ITParameterizedArray parameterizedArray) {
return parameterizedArray.getDatabaseType().getType();
}
diff --git a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ScenarioParallelRunnerExecutorKeyProvider.java b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/impl/ScenarioParallelRunnerExecutorKeyProvider.java
similarity index 79%
rename from test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ScenarioParallelRunnerExecutorKeyProvider.java
rename to test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/impl/ScenarioParallelRunnerExecutorKeyProvider.java
index defd1e185ec..8b0325b106b 100644
--- a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/ScenarioParallelRunnerExecutorKeyProvider.java
+++ b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/executor/key/impl/ScenarioParallelRunnerExecutorKeyProvider.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.framework.runner.executor.key;
+package org.apache.shardingsphere.test.integration.framework.runner.executor.key.impl;
import org.apache.shardingsphere.test.integration.framework.param.model.ITParameterizedArray;
import org.apache.shardingsphere.test.integration.framework.runner.ParallelRunningStrategy.ParallelLevel;
-import org.apache.shardingsphere.test.integration.framework.runner.param.ParameterizedArray;
+import org.apache.shardingsphere.test.integration.framework.runner.executor.key.ParallelRunnerExecutorKeyProvider;
/**
* Scenario parallel runner executor key provider.
@@ -27,9 +27,8 @@ import org.apache.shardingsphere.test.integration.framework.runner.param.Paramet
public final class ScenarioParallelRunnerExecutorKeyProvider implements ParallelRunnerExecutorKeyProvider {
@Override
- public String getKey(final ParameterizedArray parameterizedArray) {
- ITParameterizedArray itParameterizedArray = (ITParameterizedArray) parameterizedArray;
- return String.join("-", itParameterizedArray.getAdapter(), itParameterizedArray.getScenario(), itParameterizedArray.getDatabaseType().getType());
+ public String getKey(final ITParameterizedArray parameterizedArray) {
+ return String.join("-", parameterizedArray.getAdapter(), parameterizedArray.getScenario(), parameterizedArray.getDatabaseType().getType());
}
@Override
diff --git a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/param/ParameterizedArray.java b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/param/ParameterizedArray.java
deleted file mode 100644
index 9772354d7d9..00000000000
--- a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/param/ParameterizedArray.java
+++ /dev/null
@@ -1,33 +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.integration.framework.runner.param;
-
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-
-/**
- * Parameterized array.
- */
-public interface ParameterizedArray {
-
- /**
- * Get database type.
- *
- * @return database type
- */
- DatabaseType getDatabaseType();
-}
diff --git a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/param/RunnerParameters.java b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/param/RunnerParameters.java
index 37595fb1160..e9a9c16a00f 100644
--- a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/param/RunnerParameters.java
+++ b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/runner/param/RunnerParameters.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.test.integration.framework.runner.param;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
+import org.apache.shardingsphere.test.integration.framework.param.model.ITParameterizedArray;
import org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters;
import java.lang.reflect.Field;
@@ -37,11 +38,11 @@ public final class RunnerParameters {
* @return parameterized array
*/
@SneakyThrows(ReflectiveOperationException.class)
- public ParameterizedArray getParameterizedArray() {
+ public ITParameterizedArray getParameterizedArray() {
Field paramsField = BlockJUnit4ClassRunnerWithParameters.class.getDeclaredField("parameters");
paramsField.setAccessible(true);
Object[] params = (Object[]) paramsField.get(getRunner());
- return (ParameterizedArray) params[0];
+ return (ITParameterizedArray) params[0];
}
@SneakyThrows(ReflectiveOperationException.class)
diff --git a/test/integration-test/test-suite/src/test/resources/META-INF/services/org.apache.shardingsphere.test.runner.org.apache.shardingsphere.test.integration.framework.runner1.executor.key.ParallelRunnerExecutorKeyProvider b/test/integration-test/test-suite/src/test/resources/META-INF/services/org.apache.shardingsphere.test.runner.org.apache.shardingsphere.test.integration.framework.runner1.executor.key.ParallelRunnerExecutorKeyProvider
deleted file mode 100644
index d5d2a365abc..00000000000
--- a/test/integration-test/test-suite/src/test/resources/META-INF/services/org.apache.shardingsphere.test.runner.org.apache.shardingsphere.test.integration.framework.runner1.executor.key.ParallelRunnerExecutorKeyProvider
+++ /dev/null
@@ -1,19 +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.
-#
-
-org.apache.shardingsphere.test.integration.framework.runner.executor.key.CaseParallelRunnerExecutorKeyProvider
-org.apache.shardingsphere.test.integration.framework.runner.executor.key.ScenarioParallelRunnerExecutorKeyProvider