This is an automated email from the ASF dual-hosted git repository.

zhaojinchao 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 64a28c57031 Refactor H2ContainerConfigurationFactory (#28118)
64a28c57031 is described below

commit 64a28c5703108e15b1d83287592eb6f79ecba9ba
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Aug 16 15:34:29 2023 +0800

    Refactor H2ContainerConfigurationFactory (#28118)
    
    * Refactor WorkerIdNodeTest
    
    * Refactor H2ContainerConfigurationFactory
---
 .../coordinator/registry/workerid/node/WorkerIdNodeTest.java      | 2 +-
 .../storage/config/impl/h2/H2ContainerConfigurationFactory.java   | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/workerid/node/WorkerIdNodeTest.java
 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/workerid/node/WorkerIdNodeTest.java
index a30ad91db2a..8eb7cfb6d3e 100644
--- 
a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/workerid/node/WorkerIdNodeTest.java
+++ 
b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/workerid/node/WorkerIdNodeTest.java
@@ -26,6 +26,6 @@ class WorkerIdNodeTest {
     
     @Test
     void assertGetWorkerIdGeneratorPath() {
-        assertThat(WorkerIdNode.getWorkerIdGeneratorPath("instanceId"), 
is("/worker_id/instanceId"));
+        assertThat(WorkerIdNode.getWorkerIdGeneratorPath("1"), 
is("/worker_id/1"));
     }
 }
diff --git 
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/impl/h2/H2ContainerConfigurationFactory.java
 
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/impl/h2/H2ContainerConfigurationFactory.java
index b547317629a..9f53876b403 100644
--- 
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/impl/h2/H2ContainerConfigurationFactory.java
+++ 
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/impl/h2/H2ContainerConfigurationFactory.java
@@ -19,7 +19,8 @@ package 
org.apache.shardingsphere.test.e2e.env.container.atomic.storage.config.i
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.database.h2.type.H2DatabaseType;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 import 
org.apache.shardingsphere.test.e2e.env.container.atomic.storage.config.StorageContainerConfiguration;
 import 
org.apache.shardingsphere.test.e2e.env.runtime.scenario.database.DatabaseEnvironmentManager;
 import 
org.apache.shardingsphere.test.e2e.env.runtime.scenario.path.ScenarioDataPath;
@@ -55,8 +56,9 @@ public final class H2ContainerConfigurationFactory {
      */
     public static StorageContainerConfiguration newInstance(final String 
scenario) {
         Map<String, String> mountedResources = new HashMap<>(2, 1F);
-        mountedResources.put(new 
ScenarioDataPath(scenario).getInitSQLResourcePath(Type.ACTUAL, new 
H2DatabaseType()) + "/01-actual-init.sql", 
"/docker-entrypoint-initdb.d/01-actual-init.sql");
-        mountedResources.put(new 
ScenarioDataPath(scenario).getInitSQLResourcePath(Type.EXPECTED, new 
H2DatabaseType()) + "/01-expected-init.sql",
+        mountedResources.put(new 
ScenarioDataPath(scenario).getInitSQLResourcePath(Type.ACTUAL, 
TypedSPILoader.getService(DatabaseType.class, "H2")) + "/01-actual-init.sql",
+                "/docker-entrypoint-initdb.d/01-actual-init.sql");
+        mountedResources.put(new 
ScenarioDataPath(scenario).getInitSQLResourcePath(Type.EXPECTED, 
TypedSPILoader.getService(DatabaseType.class, "H2")) + "/01-expected-init.sql",
                 "/docker-entrypoint-initdb.d/01-expected-init.sql");
         return new StorageContainerConfiguration(scenario, "", 
Collections.emptyMap(), mountedResources, 
DatabaseEnvironmentManager.getDatabaseNames(scenario),
                 DatabaseEnvironmentManager.getExpectedDatabaseNames(scenario));

Reply via email to