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/07/11 04:45:03 UTC
[shardingsphere] branch master updated: Add shardingsphere-test-fixture module (#19016)
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 7be20bbff0d Add shardingsphere-test-fixture module (#19016)
7be20bbff0d is described below
commit 7be20bbff0dd9add61ad8782862fc5c13a1003aa
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Jul 11 12:44:57 2022 +0800
Add shardingsphere-test-fixture module (#19016)
---
.../shardingsphere-mode-core/pom.xml | 6 ++
.../mode/manager/ContextManager.java | 2 +-
.../fixture/MockedDataSourcePoolFieldMetaData.java | 43 --------------
.../fixture/MockedDataSourcePoolMetaData.java | 65 ----------------------
.../shardingsphere-proxy-backend/pom.xml | 6 ++
...datasource.pool.metadata.DataSourcePoolMetaData | 18 ------
shardingsphere-test/pom.xml | 1 +
.../shardingsphere-test-fixture}/pom.xml | 22 +++-----
.../MockedDataSourcePoolFieldMetaData.java | 2 +-
.../metadata}/MockedDataSourcePoolMetaData.java | 2 +-
...datasource.pool.metadata.DataSourcePoolMetaData | 2 +-
11 files changed, 24 insertions(+), 145 deletions(-)
diff --git a/shardingsphere-mode/shardingsphere-mode-core/pom.xml b/shardingsphere-mode/shardingsphere-mode-core/pom.xml
index 34ff3277a94..5755ad8eceb 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/pom.xml
+++ b/shardingsphere-mode/shardingsphere-mode-core/pom.xml
@@ -45,5 +45,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
index d6ef1670a45..8885331bd92 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
@@ -176,7 +176,7 @@ public final class ContextManager implements AutoCloseable {
if (metaDataContexts.getMetaData().getDatabases().get(databaseName).getSchemas().containsKey(schemaName)) {
metaDataContexts.getMetaData().getDatabases().get(databaseName).getSchemas().get(schemaName).remove(toBeDeletedTableName);
metaDataContexts.getOptimizerContext().dropTable(databaseName, schemaName, toBeDeletedTableName);
- // TODO check whether need to reloadRules(single table rule) if table dropped?
+ // TODO check whether need to reloadRules(single table rule) if table dropped?
}
}
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/fixture/MockedDataSourcePoolFieldMetaData.java b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/fixture/MockedDataSourcePoolFieldMetaData.java
deleted file mode 100644
index 76bce640d74..00000000000
--- a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/fixture/MockedDataSourcePoolFieldMetaData.java
+++ /dev/null
@@ -1,43 +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.mode.metadata.persist.fixture;
-
-import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolFieldMetaData;
-
-public final class MockedDataSourcePoolFieldMetaData implements DataSourcePoolFieldMetaData {
-
- @Override
- public String getUsernameFieldName() {
- return "username";
- }
-
- @Override
- public String getPasswordFieldName() {
- return "password";
- }
-
- @Override
- public String getJdbcUrlFieldName() {
- return "url";
- }
-
- @Override
- public String getJdbcUrlPropertiesFieldName() {
- return "jdbcUrlProperties";
- }
-}
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/fixture/MockedDataSourcePoolMetaData.java b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/fixture/MockedDataSourcePoolMetaData.java
deleted file mode 100644
index f4330b58ad9..00000000000
--- a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/fixture/MockedDataSourcePoolMetaData.java
+++ /dev/null
@@ -1,65 +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.mode.metadata.persist.fixture;
-
-import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolFieldMetaData;
-import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public final class MockedDataSourcePoolMetaData implements DataSourcePoolMetaData {
-
- @Override
- public Map<String, Object> getDefaultProperties() {
- return Collections.singletonMap("maxPoolSize", 100);
- }
-
- @Override
- public Map<String, Object> getInvalidProperties() {
- Map<String, Object> result = new HashMap<>(2, 1);
- result.put("maxPoolSize", -1);
- result.put("minPoolSize", -1);
- return result;
- }
-
- @Override
- public Map<String, String> getPropertySynonyms() {
- Map<String, String> result = new HashMap<>(2, 1);
- result.put("maxPoolSize", "maxPoolSize");
- result.put("minPoolSize", "minPoolSize");
- return result;
- }
-
- @Override
- public Collection<String> getTransientFieldNames() {
- return Collections.singleton("closed");
- }
-
- @Override
- public DataSourcePoolFieldMetaData getFieldMetaData() {
- return new MockedDataSourcePoolFieldMetaData();
- }
-
- @Override
- public String getType() {
- return "org.apache.shardingsphere.test.mock.MockedDataSource";
- }
-}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml b/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
index 3d33ccf104c..2fd0b72efc3 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
@@ -185,6 +185,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>com.zaxxer</groupId>
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
deleted file mode 100644
index 7cad279d417..00000000000
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
+++ /dev/null
@@ -1,18 +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.proxy.backend.text.distsql.fixture.MockedDataSourcePoolMetaData
diff --git a/shardingsphere-test/pom.xml b/shardingsphere-test/pom.xml
index 293b3d4ae66..82b1e7b6dd1 100644
--- a/shardingsphere-test/pom.xml
+++ b/shardingsphere-test/pom.xml
@@ -30,6 +30,7 @@
<modules>
<module>shardingsphere-test-common</module>
+ <module>shardingsphere-test-fixture</module>
<module>shardingsphere-integration-test</module>
<module>shardingsphere-integration-driver-test</module>
<module>shardingsphere-integration-agent-test</module>
diff --git a/shardingsphere-mode/shardingsphere-mode-core/pom.xml b/shardingsphere-test/shardingsphere-test-fixture/pom.xml
similarity index 69%
copy from shardingsphere-mode/shardingsphere-mode-core/pom.xml
copy to shardingsphere-test/shardingsphere-test-fixture/pom.xml
index 34ff3277a94..947c2e07e93 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/pom.xml
+++ b/shardingsphere-test/shardingsphere-test-fixture/pom.xml
@@ -21,29 +21,21 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-mode</artifactId>
+ <artifactId>shardingsphere-test</artifactId>
<version>5.1.3-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-mode-core</artifactId>
+ <artifactId>shardingsphere-test-fixture</artifactId>
<name>${project.artifactId}</name>
+ <properties>
+ <maven.deploy.skip>true</maven.deploy.skip>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-infra-context</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-schedule-core</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere-test-common</artifactId>
+ <artifactId>shardingsphere-infra-common</artifactId>
<version>${project.version}</version>
- <scope>test</scope>
</dependency>
</dependencies>
</project>
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/fixture/MockedDataSourcePoolFieldMetaData.java b/shardingsphere-test/shardingsphere-test-fixture/src/main/java/org/apache/shardingsphere/test/fixture/datasource/pool/metadata/MockedDataSourcePoolFieldMetaData.java
similarity index 94%
rename from shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/fixture/MockedDataSourcePoolFieldMetaData.java
rename to shardingsphere-test/shardingsphere-test-fixture/src/main/java/org/apache/shardingsphere/test/fixture/datasource/pool/metadata/MockedDataSourcePoolFieldMetaData.java
index 40fea341a32..3226361115b 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/fixture/MockedDataSourcePoolFieldMetaData.java
+++ b/shardingsphere-test/shardingsphere-test-fixture/src/main/java/org/apache/shardingsphere/test/fixture/datasource/pool/metadata/MockedDataSourcePoolFieldMetaData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.text.distsql.fixture;
+package org.apache.shardingsphere.test.fixture.datasource.pool.metadata;
import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolFieldMetaData;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/fixture/MockedDataSourcePoolMetaData.java b/shardingsphere-test/shardingsphere-test-fixture/src/main/java/org/apache/shardingsphere/test/fixture/datasource/pool/metadata/MockedDataSourcePoolMetaData.java
similarity index 96%
rename from shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/fixture/MockedDataSourcePoolMetaData.java
rename to shardingsphere-test/shardingsphere-test-fixture/src/main/java/org/apache/shardingsphere/test/fixture/datasource/pool/metadata/MockedDataSourcePoolMetaData.java
index 05dcdc3dc2e..97453c64db6 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/fixture/MockedDataSourcePoolMetaData.java
+++ b/shardingsphere-test/shardingsphere-test-fixture/src/main/java/org/apache/shardingsphere/test/fixture/datasource/pool/metadata/MockedDataSourcePoolMetaData.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.text.distsql.fixture;
+package org.apache.shardingsphere.test.fixture.datasource.pool.metadata;
import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolFieldMetaData;
import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData b/shardingsphere-test/shardingsphere-test-fixture/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
similarity index 89%
rename from shardingsphere-mode/shardingsphere-mode-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
rename to shardingsphere-test/shardingsphere-test-fixture/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
index 33af3f7897f..59ae32735c7 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
+++ b/shardingsphere-test/shardingsphere-test-fixture/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.mode.metadata.persist.fixture.MockedDataSourcePoolMetaData
+org.apache.shardingsphere.test.fixture.datasource.pool.metadata.MockedDataSourcePoolMetaData