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 1cae80a29dd Remove unused class of scaling IT (#19023)
1cae80a29dd is described below

commit 1cae80a29dd62319de1169b17f3856e52ddef073
Author: azexcy <[email protected]>
AuthorDate: Mon Jul 11 18:10:37 2022 +0800

    Remove unused class of scaling IT (#19023)
---
 .../data/pipeline/env/ITEnvironmentContext.java    |  96 --------------------
 .../data/pipeline/env/cases/DataSet.java           |  36 --------
 .../integration/data/pipeline/env/cases/Type.java  |  72 ---------------
 .../pipeline/env/config/SourceConfiguration.java   | 100 ---------------------
 .../pipeline/env/config/TargetConfiguration.java   |  55 ------------
 .../data/pipeline/util/ExecuteUtil.java            |  52 -----------
 .../integration/data/pipeline/util/Executor.java   |  31 -------
 7 files changed, 442 deletions(-)

diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/ITEnvironmentContext.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/ITEnvironmentContext.java
deleted file mode 100644
index 4de500bd417..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/ITEnvironmentContext.java
+++ /dev/null
@@ -1,96 +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.integration.data.pipeline.env;
-
-import com.google.gson.Gson;
-import lombok.Getter;
-import lombok.SneakyThrows;
-import 
org.apache.shardingsphere.data.pipeline.api.config.rulealtered.yaml.YamlRuleAlteredJobConfiguration;
-import 
org.apache.shardingsphere.data.pipeline.api.datasource.config.PipelineDataSourceConfiguration;
-import 
org.apache.shardingsphere.data.pipeline.api.datasource.config.yaml.YamlPipelineDataSourceConfiguration;
-import 
org.apache.shardingsphere.data.pipeline.core.datasource.PipelineDataSourceFactory;
-import org.apache.shardingsphere.integration.data.pipeline.env.cases.DataSet;
-import org.apache.shardingsphere.integration.data.pipeline.env.cases.Type;
-import 
org.apache.shardingsphere.integration.data.pipeline.env.config.SourceConfiguration;
-import 
org.apache.shardingsphere.integration.data.pipeline.env.config.TargetConfiguration;
-import 
org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration;
-
-import javax.sql.DataSource;
-import javax.xml.bind.JAXBContext;
-import java.io.FileReader;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Integration test environment context.
- */
-@Getter
-public final class ITEnvironmentContext {
-    
-    public static final ITEnvironmentContext INSTANCE = new 
ITEnvironmentContext();
-    
-    private static final String TYPE_TEST_XML = "/cases/mysql/types.xml";
-    
-    private final DataSet testCases;
-    
-    private final DataSource sourceDataSource;
-    
-    private final DataSource targetDataSource;
-    
-    private final String scalingConfiguration;
-    
-    public ITEnvironmentContext() {
-        testCases = loadTestCases();
-        Map<String, YamlTableRuleConfiguration> sourceTableRules = 
createSourceTableRules();
-        scalingConfiguration = createScalingConfiguration(sourceTableRules);
-        sourceDataSource = 
SourceConfiguration.createHostDataSource(sourceTableRules);
-        targetDataSource = 
PipelineDataSourceFactory.newInstance(TargetConfiguration.getHostConfiguration());
-    }
-    
-    @SneakyThrows
-    private DataSet loadTestCases() {
-        try (FileReader reader = new 
FileReader(ITEnvironmentContext.class.getResource(TYPE_TEST_XML).getPath())) {
-            return (DataSet) 
JAXBContext.newInstance(DataSet.class).createUnmarshaller().unmarshal(reader);
-        }
-    }
-    
-    private Map<String, YamlTableRuleConfiguration> createSourceTableRules() {
-        Map<String, YamlTableRuleConfiguration> result = new 
HashMap<>(testCases.getTypes().size(), 1);
-        for (Type type : testCases.getTypes()) {
-            YamlTableRuleConfiguration tableRule = new 
YamlTableRuleConfiguration();
-            tableRule.setLogicTable(type.getTableName());
-            tableRule.setActualDataNodes("ds_src." + type.getTableName());
-            result.put(type.getTableName(), tableRule);
-        }
-        return result;
-    }
-    
-    private static String createScalingConfiguration(final Map<String, 
YamlTableRuleConfiguration> tableRules) {
-        YamlRuleAlteredJobConfiguration jobConfig = new 
YamlRuleAlteredJobConfiguration();
-        
jobConfig.setSource(createYamlPipelineDataSourceConfiguration(SourceConfiguration.getDockerConfiguration(tableRules)));
-        
jobConfig.setTarget(createYamlPipelineDataSourceConfiguration(TargetConfiguration.getDockerConfiguration()));
-        return new Gson().toJson(jobConfig);
-    }
-    
-    private static YamlPipelineDataSourceConfiguration 
createYamlPipelineDataSourceConfiguration(final PipelineDataSourceConfiguration 
targetConfig) {
-        YamlPipelineDataSourceConfiguration result = new 
YamlPipelineDataSourceConfiguration();
-        result.setType(targetConfig.getType());
-        result.setParameter(targetConfig.getParameter());
-        return result;
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/cases/DataSet.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/cases/DataSet.java
deleted file mode 100644
index c96f1172cc9..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/cases/DataSet.java
+++ /dev/null
@@ -1,36 +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.integration.data.pipeline.env.cases;
-
-import lombok.Getter;
-
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Data set.
- */
-@Getter
-@XmlRootElement(name = "dataset")
-public final class DataSet {
-    
-    @XmlElement(name = "type")
-    private final List<Type> types = new LinkedList<>();
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/cases/Type.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/cases/Type.java
deleted file mode 100644
index 3c037b57664..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/cases/Type.java
+++ /dev/null
@@ -1,72 +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.integration.data.pipeline.env.cases;
-
-import lombok.Getter;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Type.
- */
-@Getter
-@XmlAccessorType(XmlAccessType.FIELD)
-public final class Type {
-    
-    private static final String TABLE_NAME_PREFIX = "type_it_";
-    
-    private static final String COLUMN_NAME = "c1";
-    
-    @XmlAttribute(required = true)
-    private String name;
-    
-    @XmlElement(name = "value")
-    private final List<String> values = new LinkedList<>();
-    
-    /**
-     * Get table name.
-     *
-     * @return table name
-     */
-    public String getTableName() {
-        return TABLE_NAME_PREFIX + name.replaceAll("[^\\w]", "_");
-    }
-    
-    /**
-     * Get column name.
-     *
-     * @return column name
-     */
-    public String getColumnName() {
-        return COLUMN_NAME;
-    }
-    
-    /**
-     * Get column type.
-     *
-     * @return column type
-     */
-    public String getColumnType() {
-        return name;
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/config/SourceConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/config/SourceConfiguration.java
deleted file mode 100644
index f1a255ea9d7..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/config/SourceConfiguration.java
+++ /dev/null
@@ -1,100 +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.integration.data.pipeline.env.config;
-
-import lombok.SneakyThrows;
-import 
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
-import org.apache.shardingsphere.infra.database.DefaultDatabase;
-import org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
-import 
org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
-import 
org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine;
-import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
-import 
org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
-import 
org.apache.shardingsphere.data.pipeline.api.datasource.config.impl.ShardingSpherePipelineDataSourceConfiguration;
-import 
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration;
-
-import javax.sql.DataSource;
-import java.sql.SQLException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Source sharding jdbc configuration.
- */
-public final class SourceConfiguration {
-    
-    private static final String SOURCE_JDBC_URL = 
"jdbc:mysql://%s/ds_src?useSSL=false";
-    
-    private static final Properties ENGINE_ENV_PROPS = 
IntegrationTestEnvironment.getInstance().getProps();
-    
-    /**
-     * Get docker sharding jdbc configuration.
-     *
-     * @param tableRules table rules
-     * @return sharding jdbc configuration
-     */
-    public static ShardingSpherePipelineDataSourceConfiguration 
getDockerConfiguration(final Map<String, YamlTableRuleConfiguration> 
tableRules) {
-        return getConfiguration(String.format(SOURCE_JDBC_URL, 
ENGINE_ENV_PROPS.getProperty("db.host.docker")), tableRules);
-    }
-    
-    /**
-     * Get host sharding jdbc configuration.
-     *
-     * @param tableRules table rules
-     * @return sharding jdbc configuration
-     */
-    public static ShardingSpherePipelineDataSourceConfiguration 
getHostConfiguration(final Map<String, YamlTableRuleConfiguration> tableRules) {
-        return getConfiguration(String.format(SOURCE_JDBC_URL, 
ENGINE_ENV_PROPS.getProperty("db.host.host")), tableRules);
-    }
-    
-    private static ShardingSpherePipelineDataSourceConfiguration 
getConfiguration(final String jdbcUrl, final Map<String, 
YamlTableRuleConfiguration> tableRules) {
-        YamlRootConfiguration rootConfig = 
getShardingJdbcConfiguration(jdbcUrl, tableRules);
-        return new 
ShardingSpherePipelineDataSourceConfiguration(YamlEngine.marshal(rootConfig));
-    }
-    
-    private static YamlRootConfiguration getShardingJdbcConfiguration(final 
String jdbcUrl, final Map<String, YamlTableRuleConfiguration> tableRules) {
-        Map<String, Object> dataSources = new HashMap<>();
-        dataSources.put("dataSourceClassName", 
"com.zaxxer.hikari.HikariDataSource");
-        dataSources.put("jdbcUrl", jdbcUrl);
-        dataSources.put("username", 
ENGINE_ENV_PROPS.getProperty("db.username"));
-        dataSources.put("password", 
ENGINE_ENV_PROPS.getProperty("db.password"));
-        YamlRootConfiguration result = new YamlRootConfiguration();
-        result.setDataSources(Collections.singletonMap("ds_src", dataSources));
-        YamlShardingRuleConfiguration shardingRuleConfig = new 
YamlShardingRuleConfiguration();
-        shardingRuleConfig.setTables(tableRules);
-        result.setRules(Collections.singleton(shardingRuleConfig));
-        return result;
-    }
-    
-    /**
-     * Create host ShardingSphere data source.
-     *
-     * @param tableRules table rules
-     * @return data source
-     */
-    @SneakyThrows(SQLException.class)
-    public static DataSource createHostDataSource(final Map<String, 
YamlTableRuleConfiguration> tableRules) {
-        ShardingSpherePipelineDataSourceConfiguration config = 
getHostConfiguration(tableRules);
-        return new ShardingSphereDataSource(DefaultDatabase.LOGIC_NAME,
-                null, new 
YamlDataSourceConfigurationSwapper().swapToDataSources(config.getRootConfig().getDataSources()),
-                new 
YamlRuleConfigurationSwapperEngine().swapToRuleConfigurations(config.getRootConfig().getRules()),
 null);
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/config/TargetConfiguration.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/config/TargetConfiguration.java
deleted file mode 100644
index 8a76e3c794b..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/env/config/TargetConfiguration.java
+++ /dev/null
@@ -1,55 +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.integration.data.pipeline.env.config;
-
-import 
org.apache.shardingsphere.data.pipeline.api.datasource.config.impl.StandardPipelineDataSourceConfiguration;
-import 
org.apache.shardingsphere.integration.data.pipeline.env.IntegrationTestEnvironment;
-
-import java.util.Properties;
-
-/**
- * Target standard jdbc configuration.
- */
-public final class TargetConfiguration {
-    
-    private static final String TARGET_JDBC_URL = 
"jdbc:mysql://%s/ds_dst?useSSL=false";
-    
-    private static final Properties ENGINE_ENV_PROPS = 
IntegrationTestEnvironment.getInstance().getProps();
-    
-    /**
-     * Get docker standard pipeline configuration.
-     *
-     * @return standard pipeline configuration
-     */
-    public static StandardPipelineDataSourceConfiguration 
getDockerConfiguration() {
-        return 
getConfiguration(ENGINE_ENV_PROPS.getProperty("db.host.docker"));
-    }
-    
-    /**
-     * Get host standard pipeline configuration.
-     *
-     * @return standard pipeline configuration
-     */
-    public static StandardPipelineDataSourceConfiguration 
getHostConfiguration() {
-        return getConfiguration(ENGINE_ENV_PROPS.getProperty("db.host.host"));
-    }
-    
-    private static StandardPipelineDataSourceConfiguration 
getConfiguration(final String host) {
-        return new 
StandardPipelineDataSourceConfiguration(String.format(TARGET_JDBC_URL, host), 
ENGINE_ENV_PROPS.getProperty("db.username"), 
ENGINE_ENV_PROPS.getProperty("db.password"));
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/ExecuteUtil.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/ExecuteUtil.java
deleted file mode 100644
index 764e5bde899..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/ExecuteUtil.java
+++ /dev/null
@@ -1,52 +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.integration.data.pipeline.util;
-
-import lombok.RequiredArgsConstructor;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Execute util.
- */
-@RequiredArgsConstructor
-public final class ExecuteUtil {
-    
-    private final Executor executor;
-    
-    private final int retryCount;
-    
-    private final long waitMs;
-    
-    /**
-     * Execute.
-     *
-     * @return execute result
-     */
-    public boolean execute() {
-        int count = 0;
-        while (!executor.execute() && retryCount > count) {
-            try {
-                TimeUnit.MILLISECONDS.sleep(waitMs);
-            } catch (final InterruptedException ignored) {
-            }
-            count++;
-        }
-        return retryCount > count;
-    }
-}
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/Executor.java
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/Executor.java
deleted file mode 100644
index c019ede1545..00000000000
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/util/Executor.java
+++ /dev/null
@@ -1,31 +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.integration.data.pipeline.util;
-
-/**
- * Executor.
- */
-public interface Executor {
-    
-    /**
-     * Execute.
-     *
-     * @return execute result
-     */
-    boolean execute();
-}

Reply via email to