You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/04/25 05:36:25 UTC
[shardingsphere] branch master updated: Rename scaling IT test to avoid running at unit test (#17082)
This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 bdd9e0ac7ad Rename scaling IT test to avoid running at unit test (#17082)
bdd9e0ac7ad is described below
commit bdd9e0ac7ad2955d188d5556476aa51e54a67f1d
Author: azexcy <10...@users.noreply.github.com>
AuthorDate: Mon Apr 25 13:36:13 2022 +0800
Rename scaling IT test to avoid running at unit test (#17082)
---
.../integration/data/pipline/cases/BaseScalingITCase.java | 3 +--
.../data/pipline/cases/command/CommonSQLCommand.java | 3 ++-
.../MySQLCommand.java => CreateTableSQLCommand.java} | 4 ++--
.../data/pipline/cases/mysql/BaseMySQLScalingCase.java | 10 +++++-----
...LManualScalingTest.java => MySQLManualScalingCase.java} | 2 +-
.../pipline/container/compose/DockerComposedContainer.java | 5 ++---
.../src/test/resources/env/common/command.xml | 14 ++++++++++----
7 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/BaseScalingITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/BaseScalingITCase.java
index fb635cf9f95..34e559e52cc 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/BaseScalingITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/BaseScalingITCase.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.integration.data.pipline.cases;
import com.google.common.base.Joiner;
-import com.google.common.base.Splitter;
import com.google.common.collect.Sets;
import lombok.AccessLevel;
import lombok.Getter;
@@ -87,7 +86,7 @@ public abstract class BaseScalingITCase {
connection.createStatement().execute(String.format(commonSQLCommand.getAddResource(), dbIndex, getDatabaseUrl(), value));
dbIndex++;
}
- for (String sql : Splitter.on(";").splitToList(commonSQLCommand.getCreateShardingAlgorithm()).stream().filter(StringUtils::isNotBlank).collect(Collectors.toList())) {
+ for (String sql : commonSQLCommand.getCreateShardingAlgorithm()) {
connection.createStatement().execute(sql);
}
// TODO sleep to wait for sharding algorithm table created,otherwise, the next sql will fail.
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CommonSQLCommand.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CommonSQLCommand.java
index ef181aadee0..fdc5e121802 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CommonSQLCommand.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CommonSQLCommand.java
@@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
@Data
@XmlRootElement(name = "command")
@@ -39,7 +40,7 @@ public final class CommonSQLCommand {
private String useDatabase;
@XmlElement(name = "create-sharding-algorithm")
- private String createShardingAlgorithm;
+ private List<String> createShardingAlgorithm;
@XmlElement(name = "create-sharding-table")
private String createShardingTable;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/mysql/MySQLCommand.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CreateTableSQLCommand.java
similarity index 96%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/mysql/MySQLCommand.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CreateTableSQLCommand.java
index e14b72d5545..f9fc332c5b9 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/mysql/MySQLCommand.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/command/CreateTableSQLCommand.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.integration.data.pipline.cases.command.mysql;
+package org.apache.shardingsphere.integration.data.pipline.cases.command;
import lombok.Data;
@@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlRootElement;
@Data
@XmlRootElement(name = "command")
@XmlAccessorType(XmlAccessType.FIELD)
-public final class MySQLCommand {
+public final class CreateTableSQLCommand {
@XmlElement(name = "create-table-order")
private String createTableOrder;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/BaseMySQLScalingCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/BaseMySQLScalingCase.java
index a4593c6feee..8411bfaaeb4 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/BaseMySQLScalingCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/BaseMySQLScalingCase.java
@@ -21,7 +21,7 @@ import lombok.Getter;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.integration.data.pipline.cases.BaseScalingITCase;
-import org.apache.shardingsphere.integration.data.pipline.cases.command.mysql.MySQLCommand;
+import org.apache.shardingsphere.integration.data.pipline.cases.command.CreateTableSQLCommand;
import org.apache.shardingsphere.integration.data.pipline.util.TableCrudUtil;
import javax.xml.bind.JAXB;
@@ -30,16 +30,16 @@ import java.util.List;
public abstract class BaseMySQLScalingCase extends BaseScalingITCase {
@Getter
- private final MySQLCommand mySQLCommand;
+ private final CreateTableSQLCommand createTableSQLCommand;
public BaseMySQLScalingCase() {
super(new MySQLDatabaseType());
- mySQLCommand = JAXB.unmarshal(BaseMySQLScalingCase.class.getClassLoader().getResource("env/mysql/sql.xml"), MySQLCommand.class);
+ createTableSQLCommand = JAXB.unmarshal(BaseMySQLScalingCase.class.getClassLoader().getResource("env/mysql/sql.xml"), CreateTableSQLCommand.class);
}
protected void initTableAndData() {
- getJdbcTemplate().execute(mySQLCommand.getCreateTableOrder());
- getJdbcTemplate().execute(mySQLCommand.getCreateTableOrderItem());
+ getJdbcTemplate().execute(createTableSQLCommand.getCreateTableOrder());
+ getJdbcTemplate().execute(createTableSQLCommand.getCreateTableOrderItem());
Pair<List<Object[]>, List<Object[]>> dataPair = TableCrudUtil.generateInsertDataList(3000);
getJdbcTemplate().batchUpdate(getCommonSQLCommand().getInsertOrder(), dataPair.getLeft());
getJdbcTemplate().batchUpdate(getCommonSQLCommand().getInsertOrderItem(), dataPair.getRight());
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLManualScalingTest.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLManualScalingCase.java
similarity index 97%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLManualScalingTest.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLManualScalingCase.java
index a5fe339188d..5a682c752b8 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLManualScalingTest.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/cases/mysql/MySQLManualScalingCase.java
@@ -36,7 +36,7 @@ import static org.junit.Assert.assertThat;
* MySQL manual scaling test case.
*/
@Slf4j
-public final class MySQLManualScalingTest extends BaseMySQLScalingCase {
+public final class MySQLManualScalingCase extends BaseMySQLScalingCase {
private Thread increaseTaskThread;
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/DockerComposedContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/DockerComposedContainer.java
index 9a585fcb4c4..a5380513482 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/DockerComposedContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipline/container/compose/DockerComposedContainer.java
@@ -53,9 +53,8 @@ public final class DockerComposedContainer extends BaseComposedContainer {
public DataSource getProxyDataSource(final String databaseName) {
HikariDataSource result = new HikariDataSource();
result.setDriverClassName(DataSourceEnvironment.getDriverClassName(getDatabaseContainer().getDatabaseType()));
- String jdbcUrl = StringUtils.appendIfMissing(DataSourceEnvironment.getURL(getDatabaseContainer().getDatabaseType(), getProxyContainer().getHost(),
- getProxyContainer().getFirstMappedPort(), databaseName), "&rewriteBatchedStatements=true");
- result.setJdbcUrl(jdbcUrl);
+ String jdbcUrl = DataSourceEnvironment.getURL(getDatabaseContainer().getDatabaseType(), getProxyContainer().getHost(), getProxyContainer().getFirstMappedPort(), databaseName);
+ result.setJdbcUrl(StringUtils.appendIfMissing(jdbcUrl, "&rewriteBatchedStatements=true"));
result.setUsername("root");
result.setPassword("root");
result.setMaximumPoolSize(2);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
index 9f5682a410b..525f3e23fc4 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/common/command.xml
@@ -29,14 +29,20 @@
</add-resource>
<create-sharding-algorithm>
- CREATE SHARDING ALGORITHM database_inline (
- TYPE(NAME=INLINE,PROPERTIES("algorithm-expression"="ds_${user_id % 2}")));
- CREATE SHARDING ALGORITHM t_order_inline (
- TYPE(NAME=INLINE,PROPERTIES("algorithm-expression"="t_order_${order_id % 2}")));
CREATE SHARDING ALGORITHM t_order_item_inline (
TYPE(NAME=INLINE,PROPERTIES("algorithm-expression"="t_order_item_${order_id % 2}")))
</create-sharding-algorithm>
+ <create-sharding-algorithm>
+ CREATE SHARDING ALGORITHM database_inline (
+ TYPE(NAME=INLINE,PROPERTIES("algorithm-expression"="ds_${user_id % 2}")))
+ </create-sharding-algorithm>
+
+ <create-sharding-algorithm>
+ CREATE SHARDING ALGORITHM t_order_inline (
+ TYPE(NAME=INLINE,PROPERTIES("algorithm-expression"="t_order_${order_id % 2}")))
+ </create-sharding-algorithm>
+
<create-sharding-table>
CREATE SHARDING TABLE RULE t_order (
DATANODES("ds_${0..1}.t_order_${0..1}"),