You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2021/01/13 07:13:06 UTC
[shardingsphere] branch master updated: Rename DatabaseEnvironment
(#9011)
This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 19354d0 Rename DatabaseEnvironment (#9011)
19354d0 is described below
commit 19354d0c0c93d1a428688365f614a4dd455935ac
Author: Liang Zhang <te...@163.com>
AuthorDate: Wed Jan 13 15:12:49 2021 +0800
Rename DatabaseEnvironment (#9011)
* Rename DatabaseEnvironment
* Rename DatabaseEnvironment
---
.../test/integration/engine/it/BaseIT.java | 4 ++--
.../DatabaseEnvironment.java} | 6 +++---
.../DatabaseEnvironmentManager.java} | 18 +++++++++---------
.../datasource/builder/ActualDataSourceBuilder.java | 4 ++--
4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BaseIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BaseIT.java
index 74c2cd2..d34534d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BaseIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/BaseIT.java
@@ -26,7 +26,7 @@ import org.apache.shardingsphere.test.integration.env.EnvironmentPath;
import org.apache.shardingsphere.test.integration.env.IntegrateTestEnvironment;
import org.apache.shardingsphere.test.integration.env.datasource.builder.ActualDataSourceBuilder;
import org.apache.shardingsphere.test.integration.env.datasource.builder.ProxyDataSourceBuilder;
-import org.apache.shardingsphere.test.integration.env.schema.SchemaEnvironmentManager;
+import org.apache.shardingsphere.test.integration.env.database.DatabaseEnvironmentManager;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -82,7 +82,7 @@ public abstract class BaseIT {
@BeforeClass
public static void executeInitSQLs() throws IOException, JAXBException, SQLException {
if (!IntegrateTestEnvironment.getInstance().isEnvironmentPrepared()) {
- SchemaEnvironmentManager.executeInitSQLs();
+ DatabaseEnvironmentManager.executeInitSQLs();
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/schema/SchemaEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/database/DatabaseEnvironment.java
similarity index 88%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/schema/SchemaEnvironment.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/database/DatabaseEnvironment.java
index 18bd15c..8c0e7cd 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/schema/SchemaEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/database/DatabaseEnvironment.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.env.schema;
+package org.apache.shardingsphere.test.integration.env.database;
import lombok.Getter;
@@ -25,11 +25,11 @@ import java.util.Collection;
import java.util.LinkedList;
/**
- * XML definition of schema environment.
+ * XML definition of database environment.
*/
@Getter
@XmlRootElement(name = "databases")
-public final class SchemaEnvironment {
+public final class DatabaseEnvironment {
@XmlElement(name = "database")
private final Collection<String> databases = new LinkedList<>();
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/schema/SchemaEnvironmentManager.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/database/DatabaseEnvironmentManager.java
similarity index 84%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/schema/SchemaEnvironmentManager.java
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/database/DatabaseEnvironmentManager.java
index 708efc7..3d81251 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/schema/SchemaEnvironmentManager.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/database/DatabaseEnvironmentManager.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.integration.env.schema;
+package org.apache.shardingsphere.test.integration.env.database;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -39,23 +39,23 @@ import java.util.Collection;
* Schema environment manager.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class SchemaEnvironmentManager {
+public final class DatabaseEnvironmentManager {
/**
- * Get data source names.
+ * Get database names.
*
* @param scenario scenario
- * @return data source names
+ * @return database names
* @throws IOException IO exception
* @throws JAXBException JAXB exception
*/
- public static Collection<String> getDataSourceNames(final String scenario) throws IOException, JAXBException {
+ public static Collection<String> getDatabaseNames(final String scenario) throws IOException, JAXBException {
return unmarshal(EnvironmentPath.getDatabasesFile(scenario)).getDatabases();
}
- private static SchemaEnvironment unmarshal(final String schemaEnvironmentConfigFile) throws IOException, JAXBException {
- try (FileReader reader = new FileReader(schemaEnvironmentConfigFile)) {
- return (SchemaEnvironment) JAXBContext.newInstance(SchemaEnvironment.class).createUnmarshaller().unmarshal(reader);
+ private static DatabaseEnvironment unmarshal(final String databasesFile) throws IOException, JAXBException {
+ try (FileReader reader = new FileReader(databasesFile)) {
+ return (DatabaseEnvironment) JAXBContext.newInstance(DatabaseEnvironment.class).createUnmarshaller().unmarshal(reader);
}
}
@@ -87,7 +87,7 @@ public final class SchemaEnvironmentManager {
private static void executeInitSQLForSchemaNotSupportedDatabase(final String scenario, final DatabaseType databaseType) throws IOException, JAXBException, SQLException {
File file = new File(EnvironmentPath.getInitSQLFile(databaseType, scenario));
- for (String each : getDataSourceNames(scenario)) {
+ for (String each : getDatabaseNames(scenario)) {
// TODO use multiple threads to improve performance
DataSource dataSource = ActualDataSourceBuilder.build(each, scenario, databaseType);
executeSQLScript(dataSource, file);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/datasource/builder/ActualDataSourceBuilder.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/datasource/builder/ActualDataSourceBuilder.java
index b33ba65..67d3c4d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/datasource/builder/ActualDataSourceBuilder.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/datasource/builder/ActualDataSourceBuilder.java
@@ -25,7 +25,7 @@ import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.test.integration.env.IntegrateTestEnvironment;
import org.apache.shardingsphere.test.integration.env.datasource.DatabaseEnvironment;
-import org.apache.shardingsphere.test.integration.env.schema.SchemaEnvironmentManager;
+import org.apache.shardingsphere.test.integration.env.database.DatabaseEnvironmentManager;
import javax.sql.DataSource;
import javax.xml.bind.JAXBException;
@@ -56,7 +56,7 @@ public final class ActualDataSourceBuilder {
* @throws JAXBException JAXB exception
*/
public static Map<String, DataSource> createActualDataSources(final String scenario, final DatabaseType databaseType) throws IOException, JAXBException {
- Collection<String> dataSourceNames = SchemaEnvironmentManager.getDataSourceNames(scenario);
+ Collection<String> dataSourceNames = DatabaseEnvironmentManager.getDatabaseNames(scenario);
Map<String, DataSource> result = new HashMap<>(dataSourceNames.size(), 1);
for (String each : dataSourceNames) {
result.put(each, build(each, scenario, databaseType));