From 997cfe1320c970080c7ed4c0961189605a2f9428 Mon Sep 17 00:00:00 2001 From: Liang Zhang Date: Thu, 26 Sep 2024 01:10:45 +0800 Subject: [PATCH] Remove useless GlobalRulePersistServiceFixtureYamlRuleConfiguration (#33004) --- .../global/GlobalRulePersistServiceTest.java | 6 ++-- ...stServiceFixtureYamlRuleConfiguration.java | 31 ------------------- 2 files changed, 3 insertions(+), 34 deletions(-) delete mode 100644 kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/service/config/global/fixture/GlobalRulePersistServiceFixtureYamlRuleConfiguration.java diff --git a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistServiceTest.java b/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistServiceTest.java index 91f3f27a316d6..6e80fa22d4857 100644 --- a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistServiceTest.java +++ b/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/service/config/global/GlobalRulePersistServiceTest.java @@ -21,8 +21,8 @@ import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader; import org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration; import org.apache.shardingsphere.infra.yaml.config.swapper.rule.YamlRuleConfigurationSwapper; +import org.apache.shardingsphere.metadata.persist.fixture.YamlRuleConfigurationFixture; import org.apache.shardingsphere.metadata.persist.service.config.RepositoryTuplePersistService; -import org.apache.shardingsphere.metadata.persist.service.config.global.fixture.GlobalRulePersistServiceFixtureYamlRuleConfiguration; import org.apache.shardingsphere.metadata.persist.service.version.MetaDataVersionPersistService; import org.apache.shardingsphere.mode.spi.PersistRepository; import org.apache.shardingsphere.test.mock.AutoMockExtension; @@ -81,7 +81,7 @@ void assertPersistWithVersions() { RuleConfiguration ruleConfig = mock(RuleConfiguration.class); YamlRuleConfigurationSwapper swapper = mock(YamlRuleConfigurationSwapper.class); when(OrderedSPILoader.getServices(YamlRuleConfigurationSwapper.class, Collections.singleton(ruleConfig))).thenReturn(Collections.singletonMap(ruleConfig, swapper)); - YamlRuleConfiguration yamlRuleConfig = new GlobalRulePersistServiceFixtureYamlRuleConfiguration(); + YamlRuleConfiguration yamlRuleConfig = new YamlRuleConfigurationFixture(); when(swapper.swapToYamlConfiguration(ruleConfig)).thenReturn(yamlRuleConfig); when(repository.query("/rules/fixture/active_version")).thenReturn("10"); when(repository.getChildrenKeys("/rules/fixture/versions")).thenReturn(Collections.singletonList("10")); @@ -97,7 +97,7 @@ void assertPersistWithoutVersions() { RuleConfiguration ruleConfig = mock(RuleConfiguration.class); YamlRuleConfigurationSwapper swapper = mock(YamlRuleConfigurationSwapper.class); when(OrderedSPILoader.getServices(YamlRuleConfigurationSwapper.class, Collections.singleton(ruleConfig))).thenReturn(Collections.singletonMap(ruleConfig, swapper)); - YamlRuleConfiguration yamlRuleConfig = new GlobalRulePersistServiceFixtureYamlRuleConfiguration(); + YamlRuleConfiguration yamlRuleConfig = new YamlRuleConfigurationFixture(); when(swapper.swapToYamlConfiguration(ruleConfig)).thenReturn(yamlRuleConfig); when(repository.getChildrenKeys("/rules/fixture/versions")).thenReturn(Collections.emptyList()); globalRulePersistService.persist(Collections.singleton(ruleConfig)); diff --git a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/service/config/global/fixture/GlobalRulePersistServiceFixtureYamlRuleConfiguration.java b/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/service/config/global/fixture/GlobalRulePersistServiceFixtureYamlRuleConfiguration.java deleted file mode 100644 index 3c53b6054f7ee..0000000000000 --- a/kernel/metadata/core/src/test/java/org/apache/shardingsphere/metadata/persist/service/config/global/fixture/GlobalRulePersistServiceFixtureYamlRuleConfiguration.java +++ /dev/null @@ -1,31 +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.metadata.persist.service.config.global.fixture; - -import org.apache.shardingsphere.infra.config.rule.RuleConfiguration; -import org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration; -import org.apache.shardingsphere.mode.tuple.annotation.RepositoryTupleEntity; - -@RepositoryTupleEntity(value = "fixture", leaf = true) -public final class GlobalRulePersistServiceFixtureYamlRuleConfiguration implements YamlRuleConfiguration { - - @Override - public Class getRuleConfigurationType() { - return null; - } -}