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 2021/05/31 05:10:56 UTC
[shardingsphere] branch master updated: Remove unused code (#10574)
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 0380988 Remove unused code (#10574)
0380988 is described below
commit 03809888bdd7b89a26cc7d509fae0a9d55c6bec4
Author: Haoran Meng <me...@gmail.com>
AuthorDate: Mon May 31 13:10:33 2021 +0800
Remove unused code (#10574)
---
.../statement/rdl/AlterShardingRuleStatement.java | 48 ----------------------
.../factory/MetaDataChangedListenerFactory.java | 2 +-
.../listener/impl/MetaDataChangedListener.java | 8 +---
.../core/registry/util/SchemaNameUtil.java | 45 --------------------
.../listener/impl/MetaDataChangedListenerTest.java | 3 +-
.../governance/core/registry/util/FieldUtil.java | 45 --------------------
6 files changed, 4 insertions(+), 147 deletions(-)
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/AlterShardingRuleStatement.java b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/AlterShardingRuleStatement.java
deleted file mode 100644
index 0c97ef7..0000000
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/AlterShardingRuleStatement.java
+++ /dev/null
@@ -1,48 +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.distsql.parser.statement.rdl;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.segment.FunctionSegment;
-import org.apache.shardingsphere.distsql.parser.segment.TableRuleSegment;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * Alter sharding rule statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class AlterShardingRuleStatement extends RDLStatement {
-
- private final Collection<TableRuleSegment> modifyShardingRules = new LinkedList<>();
-
- private final Collection<TableRuleSegment> addShardingRules = new LinkedList<>();
-
- private final Collection<Collection<String>> addBindingTables = new LinkedList<>();
-
- private final Collection<Collection<String>> dropBindingTables = new LinkedList<>();
-
- private final Collection<String> broadcastTables = new LinkedList();
-
- private final String defaultTableStrategyColumn;
-
- private final FunctionSegment defaultTableStrategy;
-}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/factory/MetaDataChangedListenerFactory.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/factory/MetaDataChangedListenerFactory.java
index 0f69438..565cd79 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/factory/MetaDataChangedListenerFactory.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/factory/MetaDataChangedListenerFactory.java
@@ -33,7 +33,7 @@ public final class MetaDataChangedListenerFactory implements GovernanceListenerF
@Override
public GovernanceListener create(final RegistryCenterRepository registryCenterRepository, final Collection<String> schemaNames) {
- return new MetaDataChangedListener(registryCenterRepository, schemaNames);
+ return new MetaDataChangedListener(registryCenterRepository);
}
@Override
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/impl/MetaDataChangedListener.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/impl/MetaDataChangedListener.java
index eeda371..cb7f919 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/impl/MetaDataChangedListener.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/listener/impl/MetaDataChangedListener.java
@@ -43,21 +43,17 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
- * Schemas changed listener.
+ * Metadata changed listener.
*/
public final class MetaDataChangedListener extends PostGovernanceRepositoryEventListener<GovernanceEvent> {
- private final Collection<String> existedSchemaNames;
-
- public MetaDataChangedListener(final RegistryCenterRepository registryCenterRepository, final Collection<String> schemaNames) {
+ public MetaDataChangedListener(final RegistryCenterRepository registryCenterRepository) {
super(registryCenterRepository, Collections.singleton(SchemaMetadataNode.getMetadataNodePath()));
- existedSchemaNames = new LinkedHashSet<>(schemaNames);
}
@Override
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/util/SchemaNameUtil.java b/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/util/SchemaNameUtil.java
deleted file mode 100644
index 7bab669..0000000
--- a/shardingsphere-governance/shardingsphere-governance-core/src/main/java/org/apache/shardingsphere/governance/core/registry/util/SchemaNameUtil.java
+++ /dev/null
@@ -1,45 +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.governance.core.registry.util;
-
-import com.google.common.base.Splitter;
-import com.google.common.base.Strings;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * Schema name utility.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class SchemaNameUtil {
-
- private static final String SEPARATOR = ",";
-
- /**
- * Split schema name.
- *
- * @param schemaNames schema names
- * @return schema names
- */
- public static Collection<String> splitSchemaName(final String schemaNames) {
- return Strings.isNullOrEmpty(schemaNames) ? Collections.emptyList() : Splitter.on(SEPARATOR).splitToList(schemaNames);
- }
-}
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/listener/impl/MetaDataChangedListenerTest.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/listener/impl/MetaDataChangedListenerTest.java
index 5934c73..14309e5 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/listener/impl/MetaDataChangedListenerTest.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/listener/impl/MetaDataChangedListenerTest.java
@@ -25,7 +25,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
-import java.util.Arrays;
import java.util.Optional;
import static org.junit.Assert.assertFalse;
@@ -37,7 +36,7 @@ public final class MetaDataChangedListenerTest extends GovernanceListenerTest {
@Before
public void setUp() {
- metaDataChangedListener = new MetaDataChangedListener(getRegistryCenterRepository(), Arrays.asList("sharding_db", "readwrite_splitting_db"));
+ metaDataChangedListener = new MetaDataChangedListener(getRegistryCenterRepository());
}
@Test
diff --git a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/util/FieldUtil.java b/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/util/FieldUtil.java
deleted file mode 100644
index f1eb7ab..0000000
--- a/shardingsphere-governance/shardingsphere-governance-core/src/test/java/org/apache/shardingsphere/governance/core/registry/util/FieldUtil.java
+++ /dev/null
@@ -1,45 +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.governance.core.registry.util;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import lombok.SneakyThrows;
-
-import java.lang.reflect.Field;
-
-/**
- * Field utility.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class FieldUtil {
-
- /**
- * Set field.
- *
- * @param target target to be settled
- * @param fieldName field name to be settled
- * @param fieldValue field value to be settled
- */
- @SneakyThrows(ReflectiveOperationException.class)
- public static void setField(final Object target, final String fieldName, final Object fieldValue) {
- Field field = target.getClass().getDeclaredField(fieldName);
- field.setAccessible(true);
- field.set(target, fieldValue);
- }
-}