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

wuweijie 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 a98e306  Move SchemaMetaDataPersistService to infra module (#11375)
a98e306 is described below

commit a98e30630b71029119eb15c89365e8ad9a6e60a5
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Jul 18 21:08:44 2021 +0800

    Move SchemaMetaDataPersistService to infra module (#11375)
---
 .../governance/core/registry/RegistryCenter.java   |  2 +-
 .../SchemaMetaDataRegistrySubscriber.java          |  2 +-
 .../subscriber/ScalingRegistrySubscriberTest.java  |  2 +-
 .../SchemaMetaDataRegistrySubscriberTest.java      |  2 +-
 .../src/test/resources/yaml/schema.yaml            | 29 ----------------------
 .../service/SchemaMetaDataPersistService.java      | 10 ++++----
 .../infra/config/persist/ConfigCenterTest.java     |  5 +---
 .../service/SchemaMetaDataPersistServiceTest.java  | 13 +++++-----
 .../service/impl/DataSourcePersistServiceTest.java |  2 +-
 .../service/impl/SchemaRulePersistServiceTest.java |  2 +-
 .../yaml/schema/swapper/SchemaYamlSwapperTest.java |  3 +--
 11 files changed, 19 insertions(+), 53 deletions(-)

diff --git 
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenter.java
 
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenter.java
index 53308d5..677fe65 100644
--- 
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenter.java
+++ 
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/RegistryCenter.java
@@ -24,7 +24,7 @@ import 
org.apache.shardingsphere.governance.core.registry.cache.subscriber.Scali
 import 
org.apache.shardingsphere.governance.core.registry.config.subscriber.DataSourceRegistrySubscriber;
 import 
org.apache.shardingsphere.governance.core.registry.config.subscriber.GlobalRuleRegistrySubscriber;
 import 
org.apache.shardingsphere.governance.core.registry.config.subscriber.SchemaRuleRegistrySubscriber;
-import 
org.apache.shardingsphere.governance.core.registry.metadata.service.SchemaMetaDataPersistService;
+import 
org.apache.shardingsphere.infra.config.persist.service.SchemaMetaDataPersistService;
 import 
org.apache.shardingsphere.governance.core.registry.process.subscriber.ProcessRegistrySubscriber;
 import 
org.apache.shardingsphere.governance.core.registry.state.service.DataSourceStatusRegistryService;
 import 
org.apache.shardingsphere.governance.core.registry.state.service.InstanceStatusRegistryService;
diff --git 
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriber.java
 
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriber.java
index ecfa773..78bfbf8 100644
--- 
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriber.java
+++ 
b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriber.java
@@ -20,7 +20,7 @@ package 
org.apache.shardingsphere.governance.core.registry.metadata.subscriber;
 import com.google.common.eventbus.Subscribe;
 import 
org.apache.shardingsphere.governance.core.registry.metadata.event.DatabaseCreatedSQLNotificationEvent;
 import 
org.apache.shardingsphere.governance.core.registry.metadata.event.DatabaseDroppedSQLNotificationEvent;
-import 
org.apache.shardingsphere.governance.core.registry.metadata.service.SchemaMetaDataPersistService;
+import 
org.apache.shardingsphere.infra.config.persist.service.SchemaMetaDataPersistService;
 import 
org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
 import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
 import 
org.apache.shardingsphere.infra.metadata.schema.refresher.event.SchemaAlteredEvent;
diff --git 
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriberTest.java
 
b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriberTest.java
index 83faee8..d89bcb1 100644
--- 
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriberTest.java
+++ 
b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/cache/subscriber/ScalingRegistrySubscriberTest.java
@@ -70,6 +70,6 @@ public final class ScalingRegistrySubscriberTest {
 //    @SneakyThrows({IOException.class, URISyntaxException.class})
 //    private String readYAML() {
 //        return 
Files.readAllLines(Paths.get(ClassLoader.getSystemResource("yaml/regcenter/data-schema-rule.yaml").toURI()))
-//                .stream().filter(each -> !each.startsWith("#")).map(each -> 
each + System.lineSeparator()).collect(Collectors.joining());
+//                .stream().map(each -> each + 
System.lineSeparator()).collect(Collectors.joining());
 //    }
 }
diff --git 
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriberTest.java
 
b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriberTest.java
index d491dff..3998e33 100644
--- 
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriberTest.java
+++ 
b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/subscriber/SchemaMetaDataRegistrySubscriberTest.java
@@ -19,7 +19,7 @@ package 
org.apache.shardingsphere.governance.core.registry.metadata.subscriber;
 
 import 
org.apache.shardingsphere.governance.core.registry.metadata.event.DatabaseCreatedSQLNotificationEvent;
 import 
org.apache.shardingsphere.governance.core.registry.metadata.event.DatabaseDroppedSQLNotificationEvent;
-import 
org.apache.shardingsphere.governance.core.registry.metadata.service.SchemaMetaDataPersistService;
+import 
org.apache.shardingsphere.infra.config.persist.service.SchemaMetaDataPersistService;
 import 
org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
 import 
org.apache.shardingsphere.infra.metadata.schema.refresher.event.SchemaAlteredEvent;
diff --git 
a/shardingsphere-governance/shardingsphere-governance-core/src/test/resources/yaml/schema.yaml
 
b/shardingsphere-governance/shardingsphere-governance-core/src/test/resources/yaml/schema.yaml
deleted file mode 100644
index ec02090..0000000
--- 
a/shardingsphere-governance/shardingsphere-governance-core/src/test/resources/yaml/schema.yaml
+++ /dev/null
@@ -1,29 +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.
-#
-
-tables:
-  t_order:
-    columns:
-      id:
-        caseSensitive: false
-        dataType: 0
-        generated: false
-        name: id
-        primaryKey: true
-    indexes:
-       primary:
-          name: PRIMARY
diff --git 
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/service/SchemaMetaDataPersistService.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/persist/service/SchemaMetaDataPersistService.java
similarity index 92%
rename from 
shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/service/SchemaMetaDataPersistService.java
rename to 
shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/persist/service/SchemaMetaDataPersistService.java
index 5e34699..8850008 100644
--- 
a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/metadata/service/SchemaMetaDataPersistService.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/persist/service/SchemaMetaDataPersistService.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.metadata.service;
+package org.apache.shardingsphere.infra.config.persist.service;
 
 import com.google.common.base.Strings;
 import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.yaml.schema.pojo.YamlSchema;
-import org.apache.shardingsphere.infra.yaml.schema.swapper.SchemaYamlSwapper;
-import 
org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
 import org.apache.shardingsphere.infra.config.persist.node.SchemaMetadataNode;
+import 
org.apache.shardingsphere.infra.config.persist.repository.ConfigCenterRepository;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
 import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
+import org.apache.shardingsphere.infra.yaml.schema.pojo.YamlSchema;
+import org.apache.shardingsphere.infra.yaml.schema.swapper.SchemaYamlSwapper;
 
 import java.util.Collection;
 import java.util.Optional;
@@ -35,7 +35,7 @@ import java.util.Optional;
 @RequiredArgsConstructor
 public final class SchemaMetaDataPersistService {
     
-    private final RegistryCenterRepository repository;
+    private final ConfigCenterRepository repository;
     
     /**
      * Persist schema.
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/ConfigCenterTest.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/ConfigCenterTest.java
index c9b879f..7ee97ee 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/ConfigCenterTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/ConfigCenterTest.java
@@ -56,8 +56,6 @@ public final class ConfigCenterTest {
     
     private static final String SCHEMA_RULE_YAML = 
"yaml/configcenter/data-schema-rule.yaml";
     
-    private static final String GLOBAL_RULE_YAML = 
"yaml/configcenter/data-global-rule.yaml";
-    
     @Mock
     private DataSourcePersistService dataSourceService;
     
@@ -139,7 +137,6 @@ public final class ConfigCenterTest {
     
     @SneakyThrows({IOException.class, URISyntaxException.class})
     private String readYAML(final String yamlFile) {
-        return 
Files.readAllLines(Paths.get(ClassLoader.getSystemResource(yamlFile).toURI()))
-                .stream().filter(each -> !each.startsWith("#")).map(each -> 
each + System.lineSeparator()).collect(Collectors.joining());
+        return 
Files.readAllLines(Paths.get(ClassLoader.getSystemResource(yamlFile).toURI())).stream().map(each
 -> each + System.lineSeparator()).collect(Collectors.joining());
     }
 }
diff --git 
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/service/SchemaMetaDataPersistServiceTest.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/SchemaMetaDataPersistServiceTest.java
similarity index 91%
rename from 
shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/service/SchemaMetaDataPersistServiceTest.java
rename to 
shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/SchemaMetaDataPersistServiceTest.java
index 3bed25b..c8a8468 100644
--- 
a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/metadata/service/SchemaMetaDataPersistServiceTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/SchemaMetaDataPersistServiceTest.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.governance.core.registry.metadata.service;
+package org.apache.shardingsphere.infra.config.persist.service;
 
 import lombok.SneakyThrows;
-import org.apache.shardingsphere.infra.yaml.schema.pojo.YamlSchema;
-import org.apache.shardingsphere.infra.yaml.schema.swapper.SchemaYamlSwapper;
-import 
org.apache.shardingsphere.governance.repository.spi.RegistryCenterRepository;
+import 
org.apache.shardingsphere.infra.config.persist.repository.ConfigCenterRepository;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
 import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
+import org.apache.shardingsphere.infra.yaml.schema.pojo.YamlSchema;
+import org.apache.shardingsphere.infra.yaml.schema.swapper.SchemaYamlSwapper;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -51,7 +51,7 @@ import static org.mockito.Mockito.when;
 public final class SchemaMetaDataPersistServiceTest {
     
     @Mock
-    private RegistryCenterRepository repository;
+    private ConfigCenterRepository repository;
     
     @Test
     public void assertPersist() {
@@ -93,7 +93,6 @@ public final class SchemaMetaDataPersistServiceTest {
     
     @SneakyThrows({IOException.class, URISyntaxException.class})
     private String readYAML() {
-        return 
Files.readAllLines(Paths.get(ClassLoader.getSystemResource("yaml/schema.yaml").toURI()))
-                .stream().filter(each -> !each.startsWith("#")).map(each -> 
each + System.lineSeparator()).collect(Collectors.joining());
+        return 
Files.readAllLines(Paths.get(ClassLoader.getSystemResource("yaml/schema/schema.yaml").toURI())).stream().map(each
 -> each + System.lineSeparator()).collect(Collectors.joining());
     }
 }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/impl/DataSourcePersistServiceTest.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/impl/DataSourcePersistServiceTest.java
index 64bc3bc..c70470b 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/impl/DataSourcePersistServiceTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/impl/DataSourcePersistServiceTest.java
@@ -58,7 +58,7 @@ public final class DataSourcePersistServiceTest {
     @SneakyThrows({IOException.class, URISyntaxException.class})
     private String readDataSourceYaml() {
         return 
Files.readAllLines(Paths.get(ClassLoader.getSystemResource("yaml/configcenter/data-source.yaml").toURI()))
-                .stream().filter(each -> !each.startsWith("#")).map(each -> 
each + System.lineSeparator()).collect(Collectors.joining());
+                .stream().map(each -> each + 
System.lineSeparator()).collect(Collectors.joining());
     }
     
     private void assertDataSourceConfiguration(final DataSourceConfiguration 
actual, final DataSourceConfiguration expected) {
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/impl/SchemaRulePersistServiceTest.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/impl/SchemaRulePersistServiceTest.java
index 6f7759d..935d28e 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/impl/SchemaRulePersistServiceTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/persist/service/impl/SchemaRulePersistServiceTest.java
@@ -58,6 +58,6 @@ public final class SchemaRulePersistServiceTest {
     @SneakyThrows({IOException.class, URISyntaxException.class})
     private String readYAML() {
         return 
Files.readAllLines(Paths.get(ClassLoader.getSystemResource("yaml/configcenter/data-schema-rule.yaml").toURI()))
-                .stream().filter(each -> !each.startsWith("#")).map(each -> 
each + System.lineSeparator()).collect(Collectors.joining());
+                .stream().map(each -> each + 
System.lineSeparator()).collect(Collectors.joining());
     }
 }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/SchemaYamlSwapperTest.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/SchemaYamlSwapperTest.java
index 1776f05..3de6ced 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/SchemaYamlSwapperTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/yaml/schema/swapper/SchemaYamlSwapperTest.java
@@ -77,7 +77,6 @@ public final class SchemaYamlSwapperTest {
     
     @SneakyThrows({URISyntaxException.class, IOException.class})
     private String readYAML(final String yamlFile) {
-        return 
Files.readAllLines(Paths.get(ClassLoader.getSystemResource(yamlFile).toURI()))
-                .stream().filter(each -> !each.startsWith("#")).map(each -> 
each + System.lineSeparator()).collect(Collectors.joining());
+        return 
Files.readAllLines(Paths.get(ClassLoader.getSystemResource(yamlFile).toURI())).stream().map(each
 -> each + System.lineSeparator()).collect(Collectors.joining());
     }
 }

Reply via email to