You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/07/19 09:58:12 UTC
[shardingsphere] branch master updated: Add MockedDatabaseType into shardingsphere-test-fixture module (#19357)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 123dab92b96 Add MockedDatabaseType into shardingsphere-test-fixture module (#19357)
123dab92b96 is described below
commit 123dab92b964df4407052890926d2f99de9cac99
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue Jul 19 17:58:06 2022 +0800
Add MockedDatabaseType into shardingsphere-test-fixture module (#19357)
* Add common FixtureDatabaseType
* Reuse FixtureDatabaseType
* Reuse FixtureDatabaseType
* Reuse FixtureDatabaseType
* Rename MockedDatabaseType
* Rename InfraDatabaseTypeFixture
* Refactor InfraDatabaseTypeFixture
* Remove DDLGeneratorDatabaseTypeFixture
---
.../rewrite/token/pojo/IndexTokenTest.java | 2 +-
.../rewrite/token/pojo/TableTokenTest.java | 2 +-
.../database/type/DatabaseTypeFactoryTest.java | 6 +--
.../database/type/dialect/DatabaseTypeTest.java | 6 +--
...baseType.java => InfraDatabaseTypeFixture.java} | 6 +--
...shardingsphere.infra.database.type.DatabaseType | 2 +-
.../shardingsphere-database-datetime/pom.xml | 7 +++
.../database/fixture/FixtureDatabaseType.java | 60 ---------------------
.../DatetimeLoadingSQLProviderFactoryTest.java | 4 +-
.../shardingsphere-infra-executor/pom.xml | 7 +++
.../sane/SaneQueryResultEngineFactoryTest.java | 4 +-
.../executor/sql/fixture/FixtureDatabaseType.java | 58 --------------------
.../shardingsphere-data-pipeline-api/pom.xml | 6 +++
.../CreateTableSQLGeneratorFactoryTest.java | 2 +-
.../fixture/CreateTableSQLGeneratorFixture.java | 2 +-
.../fixture/DDLGeneratorDatabaseTypeFixture.java | 61 ----------------------
...shardingsphere.infra.database.type.DatabaseType | 18 -------
.../DatabaseAdminExecutorCreatorFactoryTest.java | 4 +-
.../DatabaseAdminExecutorCreatorFixture.java | 3 +-
...shardingsphere.infra.database.type.DatabaseType | 18 -------
.../shardingsphere-proxy-frontend-core/pom.xml | 7 +++
.../DatabaseProtocolFrontendEngineFixture.java | 5 +-
.../frontend/fixture/FixtureDatabaseType.java | 61 ----------------------
.../frontend/fixture/FixtureOKProxyState.java | 3 +-
.../netty/ServerHandlerInitializerTest.java | 4 +-
.../DatabaseProtocolFrontendEngineFactoryTest.java | 4 +-
.../state/impl/OKProxyStateFactoryTest.java | 4 +-
...shardingsphere.infra.database.type.DatabaseType | 18 -------
.../protocol/fixture/DummyDatabaseType.java | 59 ---------------------
...shardingsphere.infra.database.type.DatabaseType | 18 -------
.../shardingsphere-test-fixture/pom.xml | 6 +++
.../fixture/database/type/MockedDatabaseType.java | 17 +++---
...shardingsphere.infra.database.type.DatabaseType | 2 +-
33 files changed, 77 insertions(+), 409 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/IndexTokenTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/IndexTokenTest.java
index 303961ec86c..83030da5c6b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/IndexTokenTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/IndexTokenTest.java
@@ -34,7 +34,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.Identifi
import org.junit.Test;
public final class IndexTokenTest {
-
+
@Test
public void assertToString() {
IndexToken indexToken = new IndexToken(0, 0,
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/TableTokenTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/TableTokenTest.java
index 9440da654c0..9d6e1cc22c0 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/TableTokenTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rewrite/token/pojo/TableTokenTest.java
@@ -35,7 +35,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.Identifi
import org.junit.Test;
public final class TableTokenTest {
-
+
@Test
public void assertToString() {
SimpleTableSegment simpleTableSegment = new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("t_order")));
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeFactoryTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeFactoryTest.java
index c470a9541b2..761db34b69c 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeFactoryTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/DatabaseTypeFactoryTest.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.infra.database.type.dialect.OracleDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.SQL92DatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.SQLServerDatabaseType;
-import org.apache.shardingsphere.infra.fixture.FixtureDatabaseType;
+import org.apache.shardingsphere.infra.fixture.InfraDatabaseTypeFixture;
import org.junit.Test;
import java.util.Collection;
@@ -39,7 +39,7 @@ public final class DatabaseTypeFactoryTest {
@Test
public void assertGetInstance() {
- assertThat(DatabaseTypeFactory.getInstance("FIXTURE"), instanceOf(FixtureDatabaseType.class));
+ assertThat(DatabaseTypeFactory.getInstance("INFRA.FIXTURE"), instanceOf(InfraDatabaseTypeFixture.class));
assertThat(DatabaseTypeFactory.getInstance("SQL92"), instanceOf(SQL92DatabaseType.class));
assertThat(DatabaseTypeFactory.getInstance("MySQL"), instanceOf(MySQLDatabaseType.class));
assertThat(DatabaseTypeFactory.getInstance("MariaDB"), instanceOf(MariaDBDatabaseType.class));
@@ -55,7 +55,7 @@ public final class DatabaseTypeFactoryTest {
Collection<DatabaseType> actual = DatabaseTypeFactory.getInstances();
assertThat(actual.size(), is(9));
Iterator<DatabaseType> iterator = actual.iterator();
- assertThat(iterator.next(), instanceOf(FixtureDatabaseType.class));
+ assertThat(iterator.next(), instanceOf(InfraDatabaseTypeFixture.class));
assertThat(iterator.next(), instanceOf(SQL92DatabaseType.class));
assertThat(iterator.next(), instanceOf(MySQLDatabaseType.class));
assertThat(iterator.next(), instanceOf(MariaDBDatabaseType.class));
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/DatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/DatabaseTypeTest.java
index 2c5d7e59f2e..12b54ea76f6 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/DatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/DatabaseTypeTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.infra.database.type.dialect;
-import org.apache.shardingsphere.infra.fixture.FixtureDatabaseType;
+import org.apache.shardingsphere.infra.fixture.InfraDatabaseTypeFixture;
import org.junit.Test;
import java.sql.Connection;
@@ -34,11 +34,11 @@ public final class DatabaseTypeTest {
public void assertGetSchema() throws SQLException {
Connection connection = mock(Connection.class);
when(connection.getSchema()).thenReturn("ds");
- assertThat(new FixtureDatabaseType().getSchema(connection), is("ds"));
+ assertThat(new InfraDatabaseTypeFixture().getSchema(connection), is("ds"));
}
@Test
public void assertFormatTableNamePattern() {
- assertThat(new FixtureDatabaseType().formatTableNamePattern("tbl"), is("tbl"));
+ assertThat(new InfraDatabaseTypeFixture().formatTableNamePattern("tbl"), is("tbl"));
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/fixture/FixtureDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/fixture/InfraDatabaseTypeFixture.java
similarity index 90%
rename from shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/fixture/FixtureDatabaseType.java
rename to shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/fixture/InfraDatabaseTypeFixture.java
index a1ca8cd3dae..0efbf27e2f2 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/fixture/FixtureDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/fixture/InfraDatabaseTypeFixture.java
@@ -26,7 +26,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-public final class FixtureDatabaseType implements DatabaseType {
+public final class InfraDatabaseTypeFixture implements DatabaseType {
@Override
public QuoteCharacter getQuoteCharacter() {
@@ -35,7 +35,7 @@ public final class FixtureDatabaseType implements DatabaseType {
@Override
public Collection<String> getJdbcUrlPrefixes() {
- return Collections.singleton(String.format("jdbc:%s:", getType().toLowerCase()));
+ return Collections.singleton("jdbc:infra.fixture:");
}
@Override
@@ -55,6 +55,6 @@ public final class FixtureDatabaseType implements DatabaseType {
@Override
public String getType() {
- return "FIXTURE";
+ return "INFRA.FIXTURE";
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType b/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
index 882eb57af64..2ed2edd6f63 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.infra.fixture.FixtureDatabaseType
+org.apache.shardingsphere.infra.fixture.InfraDatabaseTypeFixture
diff --git a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/pom.xml b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/pom.xml
index 4553d8ff587..ee8c2b5a88e 100644
--- a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/pom.xml
+++ b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/pom.xml
@@ -38,6 +38,13 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
diff --git a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/fixture/FixtureDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/fixture/FixtureDatabaseType.java
deleted file mode 100644
index 401bf34fd1c..00000000000
--- a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/fixture/FixtureDatabaseType.java
+++ /dev/null
@@ -1,60 +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.datetime.database.fixture;
-
-import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public final class FixtureDatabaseType implements DatabaseType {
-
- @Override
- public QuoteCharacter getQuoteCharacter() {
- return QuoteCharacter.BACK_QUOTE;
- }
-
- @Override
- public Collection<String> getJdbcUrlPrefixes() {
- return Collections.singleton(String.format("jdbc:%s:", getType().toLowerCase()));
- }
-
- @Override
- public DataSourceMetaData getDataSourceMetaData(final String url, final String username) {
- return null;
- }
-
- @Override
- public Map<String, Collection<String>> getSystemDatabaseSchemaMap() {
- return new HashMap<>();
- }
-
- @Override
- public Collection<String> getSystemSchemas() {
- return Collections.emptyList();
- }
-
- @Override
- public String getType() {
- return "FIXTURE";
- }
-}
diff --git a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/provider/DatetimeLoadingSQLProviderFactoryTest.java b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/provider/DatetimeLoadingSQLProviderFactoryTest.java
index 2663b2d24cf..926f0368a93 100644
--- a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/provider/DatetimeLoadingSQLProviderFactoryTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/java/org/apache/shardingsphere/datetime/database/provider/DatetimeLoadingSQLProviderFactoryTest.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.datetime.database.provider;
-import org.apache.shardingsphere.datetime.database.fixture.FixtureDatabaseType;
import org.apache.shardingsphere.datetime.database.fixture.FixtureDatetimeLoadingSQLProvider;
+import org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
@@ -28,6 +28,6 @@ public final class DatetimeLoadingSQLProviderFactoryTest {
@Test
public void assertGetInstance() {
- assertThat(DatetimeLoadingSQLProviderFactory.getInstance(new FixtureDatabaseType()), instanceOf(FixtureDatetimeLoadingSQLProvider.class));
+ assertThat(DatetimeLoadingSQLProviderFactory.getInstance(new MockedDatabaseType()), instanceOf(FixtureDatetimeLoadingSQLProvider.class));
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/pom.xml b/shardingsphere-infra/shardingsphere-infra-executor/pom.xml
index 15b54b0f972..5d7d888f411 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/pom.xml
+++ b/shardingsphere-infra/shardingsphere-infra-executor/pom.xml
@@ -39,6 +39,13 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-mysql-client</artifactId>
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/sane/SaneQueryResultEngineFactoryTest.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/sane/SaneQueryResultEngineFactoryTest.java
index ea3720d10f2..869d14ccde8 100644
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/sane/SaneQueryResultEngineFactoryTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/jdbc/sane/SaneQueryResultEngineFactoryTest.java
@@ -18,8 +18,8 @@
package org.apache.shardingsphere.infra.executor.sql.execute.engine.jdbc.sane;
import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.sane.SaneQueryResultEngineFactory;
-import org.apache.shardingsphere.infra.executor.sql.fixture.FixtureDatabaseType;
import org.apache.shardingsphere.infra.executor.sql.fixture.FixtureSaneQueryResultEngine;
+import org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
@@ -29,6 +29,6 @@ public final class SaneQueryResultEngineFactoryTest {
@Test
public void assertGetInstance() {
- assertThat(SaneQueryResultEngineFactory.getInstance(new FixtureDatabaseType()), instanceOf(FixtureSaneQueryResultEngine.class));
+ assertThat(SaneQueryResultEngineFactory.getInstance(new MockedDatabaseType()), instanceOf(FixtureSaneQueryResultEngine.class));
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureDatabaseType.java
deleted file mode 100644
index 1e5f9c76ff2..00000000000
--- a/shardingsphere-infra/shardingsphere-infra-executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/fixture/FixtureDatabaseType.java
+++ /dev/null
@@ -1,58 +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.infra.executor.sql.fixture;
-
-import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
-
-import java.util.Collection;
-import java.util.Map;
-
-public final class FixtureDatabaseType implements DatabaseType {
-
- @Override
- public QuoteCharacter getQuoteCharacter() {
- return null;
- }
-
- @Override
- public Collection<String> getJdbcUrlPrefixes() {
- return null;
- }
-
- @Override
- public DataSourceMetaData getDataSourceMetaData(final String url, final String username) {
- return null;
- }
-
- @Override
- public Map<String, Collection<String>> getSystemDatabaseSchemaMap() {
- return null;
- }
-
- @Override
- public Collection<String> getSystemSchemas() {
- return null;
- }
-
- @Override
- public String getType() {
- return "FIXTURE";
- }
-}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/pom.xml b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/pom.xml
index 0a374028362..199091e9011 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/pom.xml
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/pom.xml
@@ -40,6 +40,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>org.apache.commons</groupId>
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/ddlgenerator/CreateTableSQLGeneratorFactoryTest.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/ddlgenerator/CreateTableSQLGeneratorFactoryTest.java
index 44d20cbbb4d..4ab75c5d45d 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/ddlgenerator/CreateTableSQLGeneratorFactoryTest.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/ddlgenerator/CreateTableSQLGeneratorFactoryTest.java
@@ -26,6 +26,6 @@ public final class CreateTableSQLGeneratorFactoryTest {
@Test
public void assertFindInstance() {
- assertTrue(CreateTableSQLGeneratorFactory.findInstance(DatabaseTypeFactory.getInstance("DDL.GENERATOR.FIXTURE")).isPresent());
+ assertTrue(CreateTableSQLGeneratorFactory.findInstance(DatabaseTypeFactory.getInstance("FIXTURE")).isPresent());
}
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/fixture/CreateTableSQLGeneratorFixture.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/fixture/CreateTableSQLGeneratorFixture.java
index d3ae097c776..90134675312 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/fixture/CreateTableSQLGeneratorFixture.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/fixture/CreateTableSQLGeneratorFixture.java
@@ -32,6 +32,6 @@ public final class CreateTableSQLGeneratorFixture implements CreateTableSQLGener
@Override
public String getType() {
- return "DDL.GENERATOR.FIXTURE";
+ return "FIXTURE";
}
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/fixture/DDLGeneratorDatabaseTypeFixture.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/fixture/DDLGeneratorDatabaseTypeFixture.java
deleted file mode 100644
index 979350da1c7..00000000000
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/java/org/apache/shardingsphere/data/pipeline/spi/fixture/DDLGeneratorDatabaseTypeFixture.java
+++ /dev/null
@@ -1,61 +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.data.pipeline.spi.fixture;
-
-import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import static org.mockito.Mockito.mock;
-
-public final class DDLGeneratorDatabaseTypeFixture implements DatabaseType {
-
- @Override
- public QuoteCharacter getQuoteCharacter() {
- return QuoteCharacter.NONE;
- }
-
- @Override
- public Collection<String> getJdbcUrlPrefixes() {
- return Collections.singleton("jdbc:ddl.generator.fixture");
- }
-
- @Override
- public DataSourceMetaData getDataSourceMetaData(final String url, final String username) {
- return mock(DataSourceMetaData.class);
- }
-
- @Override
- public Map<String, Collection<String>> getSystemDatabaseSchemaMap() {
- return Collections.emptyMap();
- }
-
- @Override
- public Collection<String> getSystemSchemas() {
- return Collections.emptyList();
- }
-
- @Override
- public String getType() {
- return "DDL.GENERATOR.FIXTURE";
- }
-}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
deleted file mode 100644
index eb024c680eb..00000000000
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
+++ /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.data.pipeline.spi.fixture.DDLGeneratorDatabaseTypeFixture
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/executor/DatabaseAdminExecutorCreatorFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/executor/DatabaseAdminExecutorCreatorFactoryTest.java
index 4141d323ed3..f0d46058af5 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/executor/DatabaseAdminExecutorCreatorFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/executor/DatabaseAdminExecutorCreatorFactoryTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.backend.text.admin.executor;
import org.apache.shardingsphere.proxy.backend.text.admin.fixture.DatabaseAdminExecutorCreatorFixture;
-import org.apache.shardingsphere.proxy.backend.text.admin.fixture.FixtureDatabaseType;
+import org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType;
import org.junit.Test;
import java.util.Optional;
@@ -31,7 +31,7 @@ public final class DatabaseAdminExecutorCreatorFactoryTest {
@Test
public void assertFindInstance() {
- Optional<DatabaseAdminExecutorCreator> actual = DatabaseAdminExecutorCreatorFactory.findInstance(new FixtureDatabaseType());
+ Optional<DatabaseAdminExecutorCreator> actual = DatabaseAdminExecutorCreatorFactory.findInstance(new MockedDatabaseType());
assertTrue(actual.isPresent());
assertThat(actual.get(), instanceOf(DatabaseAdminExecutorCreatorFixture.class));
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/fixture/DatabaseAdminExecutorCreatorFixture.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/fixture/DatabaseAdminExecutorCreatorFixture.java
index eeb1e0a1e23..62d7611ed96 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/fixture/DatabaseAdminExecutorCreatorFixture.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/fixture/DatabaseAdminExecutorCreatorFixture.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.backend.text.admin.fixture;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import org.apache.shardingsphere.proxy.backend.text.admin.executor.DatabaseAdminExecutor;
import org.apache.shardingsphere.proxy.backend.text.admin.executor.DatabaseAdminExecutorCreator;
+import org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType;
import java.util.Collection;
import java.util.Optional;
@@ -38,7 +39,7 @@ public final class DatabaseAdminExecutorCreatorFixture implements DatabaseAdminE
@Override
public String getType() {
- return new FixtureDatabaseType().getType();
+ return new MockedDatabaseType().getType();
}
@Override
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
deleted file mode 100644
index 81caff5400e..00000000000
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
+++ /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.admin.fixture.FixtureDatabaseType
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/pom.xml b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/pom.xml
index 6f3ca3ba24b..990fb3d464f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/pom.xml
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/pom.xml
@@ -44,6 +44,13 @@
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-test-fixture</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
index 8a4f172ea5f..5f871bc3683 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/DatabaseProtocolFrontendEngineFixture.java
@@ -19,10 +19,11 @@ package org.apache.shardingsphere.proxy.frontend.fixture;
import org.apache.shardingsphere.db.protocol.codec.DatabasePacketCodecEngine;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
import org.apache.shardingsphere.proxy.frontend.authentication.AuthenticationEngine;
import org.apache.shardingsphere.proxy.frontend.command.CommandExecuteEngine;
+import org.apache.shardingsphere.proxy.frontend.context.FrontendContext;
import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
+import org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType;
public final class DatabaseProtocolFrontendEngineFixture implements DatabaseProtocolFrontendEngine {
@@ -56,6 +57,6 @@ public final class DatabaseProtocolFrontendEngineFixture implements DatabaseProt
@Override
public String getType() {
- return new FixtureDatabaseType().getType();
+ return new MockedDatabaseType().getType();
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureDatabaseType.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureDatabaseType.java
deleted file mode 100644
index 6dbb29e6272..00000000000
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureDatabaseType.java
+++ /dev/null
@@ -1,61 +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.proxy.frontend.fixture;
-
-import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import static org.mockito.Mockito.mock;
-
-public final class FixtureDatabaseType implements DatabaseType {
-
- @Override
- public String getType() {
- return "FixtureDB";
- }
-
- @Override
- public QuoteCharacter getQuoteCharacter() {
- return QuoteCharacter.NONE;
- }
-
- @Override
- public Collection<String> getJdbcUrlPrefixes() {
- return Collections.singleton("jdbc:fixture");
- }
-
- @Override
- public DataSourceMetaData getDataSourceMetaData(final String url, final String username) {
- return mock(DataSourceMetaData.class);
- }
-
- @Override
- public Map<String, Collection<String>> getSystemDatabaseSchemaMap() {
- return Collections.emptyMap();
- }
-
- @Override
- public Collection<String> getSystemSchemas() {
- return Collections.emptyList();
- }
-}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureOKProxyState.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureOKProxyState.java
index 700b55d3671..b44e86caf2b 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureOKProxyState.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/fixture/FixtureOKProxyState.java
@@ -21,6 +21,7 @@ import io.netty.channel.ChannelHandlerContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
import org.apache.shardingsphere.proxy.frontend.state.impl.OKProxyState;
+import org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType;
public final class FixtureOKProxyState implements OKProxyState {
@@ -30,6 +31,6 @@ public final class FixtureOKProxyState implements OKProxyState {
@Override
public String getType() {
- return new FixtureDatabaseType().getType();
+ return new MockedDatabaseType().getType();
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializerTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializerTest.java
index b0c80cc675b..17c36bdecd3 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/netty/ServerHandlerInitializerTest.java
@@ -21,7 +21,7 @@ import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import org.apache.shardingsphere.db.protocol.codec.PacketCodec;
import org.apache.shardingsphere.db.protocol.netty.ChannelAttrInitializer;
-import org.apache.shardingsphere.proxy.frontend.fixture.FixtureDatabaseType;
+import org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType;
import org.junit.Test;
import org.mockito.MockedConstruction;
@@ -38,7 +38,7 @@ public final class ServerHandlerInitializerTest {
SocketChannel channel = mock(SocketChannel.class);
ChannelPipeline pipeline = mock(ChannelPipeline.class);
when(channel.pipeline()).thenReturn(pipeline);
- ServerHandlerInitializer initializer = new ServerHandlerInitializer(new FixtureDatabaseType());
+ ServerHandlerInitializer initializer = new ServerHandlerInitializer(new MockedDatabaseType());
try (MockedConstruction<FrontendChannelInboundHandler> ignored = mockConstruction(FrontendChannelInboundHandler.class)) {
initializer.initChannel(channel);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/DatabaseProtocolFrontendEngineFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/DatabaseProtocolFrontendEngineFactoryTest.java
index cedfe37e59f..25bcab2ca4f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/DatabaseProtocolFrontendEngineFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/protocol/DatabaseProtocolFrontendEngineFactoryTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.frontend.protocol;
import org.apache.shardingsphere.proxy.frontend.fixture.DatabaseProtocolFrontendEngineFixture;
-import org.apache.shardingsphere.proxy.frontend.fixture.FixtureDatabaseType;
+import org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
@@ -28,6 +28,6 @@ public final class DatabaseProtocolFrontendEngineFactoryTest {
@Test
public void assertNewInstance() {
- assertThat(DatabaseProtocolFrontendEngineFactory.newInstance(new FixtureDatabaseType()), instanceOf(DatabaseProtocolFrontendEngineFixture.class));
+ assertThat(DatabaseProtocolFrontendEngineFactory.newInstance(new MockedDatabaseType()), instanceOf(DatabaseProtocolFrontendEngineFixture.class));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyStateFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyStateFactoryTest.java
index e65b6205250..62c394c07f9 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyStateFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/OKProxyStateFactoryTest.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.proxy.frontend.state.impl;
-import org.apache.shardingsphere.proxy.frontend.fixture.FixtureDatabaseType;
import org.apache.shardingsphere.proxy.frontend.fixture.FixtureOKProxyState;
+import org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.instanceOf;
@@ -28,6 +28,6 @@ public final class OKProxyStateFactoryTest {
@Test
public void assertGetInstance() {
- assertThat(OKProxyStateFactory.getInstance(new FixtureDatabaseType().getType()), instanceOf(FixtureOKProxyState.class));
+ assertThat(OKProxyStateFactory.getInstance(new MockedDatabaseType().getType()), instanceOf(FixtureOKProxyState.class));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
deleted file mode 100644
index a4c767c9e06..00000000000
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
+++ /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.frontend.fixture.FixtureDatabaseType
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/fixture/DummyDatabaseType.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/fixture/DummyDatabaseType.java
deleted file mode 100644
index 9296e11410e..00000000000
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/fixture/DummyDatabaseType.java
+++ /dev/null
@@ -1,59 +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.proxy.frontend.reactive.protocol.fixture;
-
-import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-public final class DummyDatabaseType implements DatabaseType {
-
- @Override
- public String getType() {
- return "Dummy";
- }
-
- @Override
- public QuoteCharacter getQuoteCharacter() {
- return null;
- }
-
- @Override
- public Collection<String> getJdbcUrlPrefixes() {
- return null;
- }
-
- @Override
- public DataSourceMetaData getDataSourceMetaData(final String url, final String username) {
- return null;
- }
-
- @Override
- public Map<String, Collection<String>> getSystemDatabaseSchemaMap() {
- return Collections.emptyMap();
- }
-
- @Override
- public Collection<String> getSystemSchemas() {
- return Collections.emptyList();
- }
-}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
deleted file mode 100644
index 9fb11441e81..00000000000
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-reactive-core/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
+++ /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.frontend.reactive.protocol.fixture.DummyDatabaseType
diff --git a/shardingsphere-test/shardingsphere-test-fixture/pom.xml b/shardingsphere-test/shardingsphere-test-fixture/pom.xml
index 947c2e07e93..96971faa171 100644
--- a/shardingsphere-test/shardingsphere-test-fixture/pom.xml
+++ b/shardingsphere-test/shardingsphere-test-fixture/pom.xml
@@ -37,5 +37,11 @@
<artifactId>shardingsphere-infra-common</artifactId>
<version>${project.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/fixture/FixtureDatabaseType.java b/shardingsphere-test/shardingsphere-test-fixture/src/main/java/org/apache/shardingsphere/test/fixture/database/type/MockedDatabaseType.java
similarity index 91%
rename from shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/fixture/FixtureDatabaseType.java
rename to shardingsphere-test/shardingsphere-test-fixture/src/main/java/org/apache/shardingsphere/test/fixture/database/type/MockedDatabaseType.java
index 049fd90a2b4..f0c2f6e8d29 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/admin/fixture/FixtureDatabaseType.java
+++ b/shardingsphere-test/shardingsphere-test-fixture/src/main/java/org/apache/shardingsphere/test/fixture/database/type/MockedDatabaseType.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.backend.text.admin.fixture;
+package org.apache.shardingsphere.test.fixture.database.type;
import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
@@ -27,12 +27,10 @@ import java.util.Map;
import static org.mockito.Mockito.mock;
-public final class FixtureDatabaseType implements DatabaseType {
-
- @Override
- public String getType() {
- return "FixtureDB";
- }
+/**
+ * Mocked database type.
+ */
+public final class MockedDatabaseType implements DatabaseType {
@Override
public QuoteCharacter getQuoteCharacter() {
@@ -58,4 +56,9 @@ public final class FixtureDatabaseType implements DatabaseType {
public Collection<String> getSystemSchemas() {
return Collections.emptyList();
}
+
+ @Override
+ public String getType() {
+ return "FIXTURE";
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType b/shardingsphere-test/shardingsphere-test-fixture/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
similarity index 92%
rename from shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
rename to shardingsphere-test/shardingsphere-test-fixture/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
index 18d980da547..f953619a4b3 100644
--- a/shardingsphere-infra/shardingsphere-infra-datetime/shardingsphere-infra-datetime-type/shardingsphere-database-datetime/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
+++ b/shardingsphere-test/shardingsphere-test-fixture/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.type.DatabaseType
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.datetime.database.fixture.FixtureDatabaseType
+org.apache.shardingsphere.test.fixture.database.type.MockedDatabaseType