You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/05/16 02:01:20 UTC
[shardingsphere] branch master updated: Remove Sets.newHashSet() (#17681)
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 74b1d270b5b Remove Sets.newHashSet() (#17681)
74b1d270b5b is described below
commit 74b1d270b5bc2203abcf09d40f8afb4e0a9a2b85
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon May 16 10:01:13 2022 +0800
Remove Sets.newHashSet() (#17681)
* Remove Maps.newHashMap()
* Remove Lists.newArrayList()
* Remove Sets.newHashSet()
* Remove Sets.newHashSet()
---
.../config/YamlExampleConfigurationSupportedValue.java | 13 +++++++------
.../agent/plugin/tracing/AgentRunner.java | 5 +++--
.../ShardingRuleAlteredJobConfigurationPreparer.java | 6 +++---
.../impl/ConditionValueCompareOperatorGenerator.java | 5 +++--
.../type/complex/ComplexShardingStrategyTest.java | 4 ++--
.../strategy/type/hint/HintShardingStrategyTest.java | 5 +++--
.../strategy/type/none/NoneShardingStrategyTest.java | 12 +++++++-----
.../type/standard/StandardShardingStrategyTest.java | 5 +++--
.../shardingsphere/sharding/rule/TableRuleTest.java | 8 ++++----
.../infra/binder/segment/table/TablesContextTest.java | 4 ++--
.../statement/impl/InsertStatementContextTest.java | 4 ++--
.../database/type/dialect/OpenGaussDatabaseType.java | 7 ++++---
.../database/type/dialect/PostgreSQLDatabaseType.java | 5 +++--
.../datasource/pool/creator/DataSourceReflection.java | 6 +++---
.../schema/builder/SystemSchemaBuilderRule.java | 17 +++++++++--------
.../database/type/dialect/MySQLDatabaseTypeTest.java | 4 ++--
.../type/dialect/PostgreSQLDatabaseTypeTest.java | 5 +++--
.../metadata/schema/ShardingSphereSchemaTest.java | 4 ++--
.../schema/builder/SystemSchemaBuilderRuleTest.java | 6 ++++--
.../jdbc/core/connection/ConnectionManagerTest.java | 3 +--
.../spring/boot/SpringBootStarterTest.java | 5 ++---
.../sqlbuilder/PostgreSQLPipelineSQLBuilderTest.java | 5 +++--
.../xa/jta/datasource/XATransactionDataSource.java | 5 +++--
.../mysql/MySQLInformationSchemaExecutorFactory.java | 5 +++--
.../distsql/rdl/rule/RuleDefinitionBackendHandler.java | 9 +++++----
...amlShardingWithReadwriteSplittingIntegrateTest.java | 8 +++++---
.../readwrite/YamlReadwriteSplittingIntegrateTest.java | 18 ++++++++++++------
.../driver/sharding/YamlShardingIntegrateTest.java | 11 +++++++----
.../data/pipeline/cases/base/BaseITCase.java | 7 ++++---
.../data/pipeline/cases/scenario/ScalingScenario.java | 6 +++---
30 files changed, 117 insertions(+), 90 deletions(-)
diff --git a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfigurationSupportedValue.java b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfigurationSupportedValue.java
index 08a68767990..ba5c5d446f3 100644
--- a/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfigurationSupportedValue.java
+++ b/examples/shardingsphere-example-generator/src/main/java/org/apache/shardingsphere/example/generator/core/yaml/config/YamlExampleConfigurationSupportedValue.java
@@ -17,10 +17,11 @@
package org.apache.shardingsphere.example.generator.core.yaml.config;
-import com.google.common.collect.Sets;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.Set;
/**
@@ -30,15 +31,15 @@ import java.util.Set;
@Getter
public enum YamlExampleConfigurationSupportedValue {
- PRODUCTS("products", Sets.newHashSet("jdbc", "proxy")),
+ PRODUCTS("products", new HashSet<>(Arrays.asList("jdbc", "proxy"))),
- MODES("modes", Sets.newHashSet("memory", "proxy", "cluster-zookeeper", "cluster-etcd", "standalone-file")),
+ MODES("modes", new HashSet<>(Arrays.asList("memory", "proxy", "cluster-zookeeper", "cluster-etcd", "standalone-file"))),
- TRANSACTIONS("transactions", Sets.newHashSet("local", "xa-atomikos", "xa-narayana", "xa-bitronix")),
+ TRANSACTIONS("transactions", new HashSet<>(Arrays.asList("local", "xa-atomikos", "xa-narayana", "xa-bitronix"))),
- FEATURES("features", Sets.newHashSet("shadow", "sharding", "readwrite-splitting", "encrypt", "db-discovery")),
+ FEATURES("features", new HashSet<>(Arrays.asList("shadow", "sharding", "readwrite-splitting", "encrypt", "db-discovery"))),
- FRAMEWORKS("frameworks", Sets.newHashSet("jdbc", "spring-boot-starter-jdbc", "spring-boot-starter-jpa", "spring-boot-starter-mybatis", "spring-namespace-jdbc", "spring-namespace-jpa", "spring-namespace-mybatis"));
+ FRAMEWORKS("frameworks", new HashSet<>(Arrays.asList("jdbc", "spring-boot-starter-jdbc", "spring-boot-starter-jpa", "spring-boot-starter-mybatis", "spring-namespace-jdbc", "spring-namespace-jpa", "spring-namespace-mybatis")));
private final String configItem;
diff --git a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/AgentRunner.java b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/AgentRunner.java
index 78dfc434b33..46fb450ffc0 100644
--- a/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/AgentRunner.java
+++ b/shardingsphere-agent/shardingsphere-agent-plugins/shardingsphere-agent-plugin-tracing/shardingsphere-agent-tracing-test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/AgentRunner.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.agent.plugin.tracing;
-import com.google.common.collect.Sets;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
@@ -35,7 +34,9 @@ import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
public final class AgentRunner extends BlockJUnit4ClassRunner {
@@ -59,7 +60,7 @@ public final class AgentRunner extends BlockJUnit4ClassRunner {
@Override
protected Statement withBeforeClasses(final Statement statement) {
ByteBuddyAgent.install();
- Collection<String> classes = Sets.newHashSet(ENHANCEMENT_CLASSES);
+ Collection<String> classes = new HashSet<>(Arrays.asList(ENHANCEMENT_CLASSES));
byteBuddyAgent = new AgentBuilder.Default()
.with(new ByteBuddy().with(TypeValidation.ENABLED))
.type(ElementMatchers.namedOneOf(ENHANCEMENT_CLASSES))
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/data/pipeline/ShardingRuleAlteredJobConfigurationPreparer.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/data/pipeline/ShardingRuleAlteredJobConfigurationPreparer.java
index 96495a55ed6..9121aec9cf1 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/data/pipeline/ShardingRuleAlteredJobConfigurationPreparer.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/data/pipeline/ShardingRuleAlteredJobConfigurationPreparer.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.sharding.data.pipeline;
import com.google.common.base.Joiner;
-import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.data.pipeline.api.config.TableNameSchemaNameMapping;
import org.apache.shardingsphere.data.pipeline.api.config.ingest.DumperConfiguration;
@@ -53,6 +52,7 @@ import org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfigurat
import org.apache.shardingsphere.sharding.yaml.swapper.ShardingRuleConfigurationConverter;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -199,10 +199,10 @@ public final class ShardingRuleAlteredJobConfigurationPreparer implements RuleAl
private static Set<String> extractShardingColumns(final ShardingStrategyConfiguration shardingStrategy) {
if (shardingStrategy instanceof StandardShardingStrategyConfiguration) {
- return Sets.newHashSet(((StandardShardingStrategyConfiguration) shardingStrategy).getShardingColumn());
+ return new HashSet<>(Collections.singleton(((StandardShardingStrategyConfiguration) shardingStrategy).getShardingColumn()));
}
if (shardingStrategy instanceof ComplexShardingStrategyConfiguration) {
- return Sets.newHashSet(((ComplexShardingStrategyConfiguration) shardingStrategy).getShardingColumns().split(","));
+ return new HashSet<>(Arrays.asList(((ComplexShardingStrategyConfiguration) shardingStrategy).getShardingColumns().split(",")));
}
return Collections.emptySet();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueCompareOperatorGenerator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueCompareOperatorGenerator.java
index 5c016b88a8f..4497df3f1e6 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueCompareOperatorGenerator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueCompareOperatorGenerator.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.sharding.route.engine.condition.generator.impl
import com.google.common.collect.Lists;
import com.google.common.collect.Range;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.datetime.DatetimeServiceFactory;
import org.apache.shardingsphere.sharding.route.engine.condition.Column;
import org.apache.shardingsphere.sharding.route.engine.condition.ExpressionConditionUtils;
@@ -32,7 +31,9 @@ import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.Column
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.BinaryOperationExpression;
import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.ExpressionSegment;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -51,7 +52,7 @@ public final class ConditionValueCompareOperatorGenerator implements ConditionVa
private static final String AT_LEAST = ">=";
- private static final Collection<String> OPERATORS = Sets.newHashSet(EQUAL, GREATER_THAN, LESS_THAN, AT_LEAST, AT_MOST);
+ private static final Collection<String> OPERATORS = new HashSet<>(Arrays.asList(EQUAL, GREATER_THAN, LESS_THAN, AT_LEAST, AT_MOST));
@Override
public Optional<ShardingConditionValue> generate(final BinaryOperationExpression predicate, final Column column, final List<Object> parameters) {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/complex/ComplexShardingStrategyTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/complex/ComplexShardingStrategyTest.java
index ca8252f9bff..cd3949801ce 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/complex/ComplexShardingStrategyTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/complex/ComplexShardingStrategyTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.sharding.route.strategy.type.complex;
import com.google.common.collect.Range;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
import org.apache.shardingsphere.sharding.fixture.CoreComplexKeysShardingAlgorithmFixture;
@@ -30,6 +29,7 @@ import org.junit.Test;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Properties;
@@ -42,7 +42,7 @@ public final class ComplexShardingStrategyTest {
@Test
public void assertDoSharding() {
- Collection<String> targets = Sets.newHashSet("1", "2", "3");
+ Collection<String> targets = new HashSet<>(Arrays.asList("1", "2", "3"));
ComplexShardingStrategy complexShardingStrategy = new ComplexShardingStrategy("column1, column2", new CoreComplexKeysShardingAlgorithmFixture());
List<ShardingConditionValue> shardingConditionValues =
Arrays.asList(new ListShardingConditionValue<>("column1", "logicTable", Collections.singletonList(1)), new RangeShardingConditionValue<>("column2", "logicTable", Range.open(1, 3)));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/hint/HintShardingStrategyTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/hint/HintShardingStrategyTest.java
index f60635483c5..d7151aee541 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/hint/HintShardingStrategyTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/hint/HintShardingStrategyTest.java
@@ -17,15 +17,16 @@
package org.apache.shardingsphere.sharding.route.strategy.type.hint;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
import org.apache.shardingsphere.sharding.fixture.CoreHintShardingAlgorithmFixture;
import org.apache.shardingsphere.sharding.route.engine.condition.value.ListShardingConditionValue;
import org.junit.Test;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
@@ -35,7 +36,7 @@ public final class HintShardingStrategyTest {
@Test
public void assertDoSharding() {
- Collection<String> targets = Sets.newHashSet("1", "2", "3");
+ Collection<String> targets = new HashSet<>(Arrays.asList("1", "2", "3"));
HintShardingStrategy hintShardingStrategy = new HintShardingStrategy(new CoreHintShardingAlgorithmFixture());
DataNodeInfo dataNodeInfo = new DataNodeInfo("logicTable_", 1, '0');
Collection<String> actualSharding = hintShardingStrategy.doSharding(targets, Collections.singletonList(
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/none/NoneShardingStrategyTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/none/NoneShardingStrategyTest.java
index 3fb3756998f..d49414c3fce 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/none/NoneShardingStrategyTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/none/NoneShardingStrategyTest.java
@@ -17,15 +17,17 @@
package org.apache.shardingsphere.sharding.route.strategy.type.none;
-import com.google.common.collect.Sets;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Properties;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
import org.junit.Before;
import org.junit.Test;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Properties;
+
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
@@ -41,7 +43,7 @@ public final class NoneShardingStrategyTest {
@Test
public void assertGetShardingAlgorithm() {
- Collection<String> targets = Sets.newHashSet("1", "2", "3");
+ Collection<String> targets = new HashSet<>(Arrays.asList("1", "2", "3"));
DataNodeInfo dataNodeInfo = new DataNodeInfo("logicTable_", 1, '0');
Collection<String> actualSharding = noneShardingStrategy.doSharding(targets, Collections.emptySet(), dataNodeInfo, new ConfigurationProperties(new Properties()));
assertThat(actualSharding.size(), is(3));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/standard/StandardShardingStrategyTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/standard/StandardShardingStrategyTest.java
index d13fa16de9f..0ae43ea3db9 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/standard/StandardShardingStrategyTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/strategy/type/standard/StandardShardingStrategyTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.sharding.route.strategy.type.standard;
import com.google.common.collect.Range;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
import org.apache.shardingsphere.sharding.fixture.CoreStandardShardingAlgorithmFixture;
@@ -27,8 +26,10 @@ import org.apache.shardingsphere.sharding.route.engine.condition.value.RangeShar
import org.junit.Before;
import org.junit.Test;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Properties;
import static org.hamcrest.CoreMatchers.is;
@@ -36,7 +37,7 @@ import static org.junit.Assert.assertThat;
public final class StandardShardingStrategyTest {
- private final Collection<String> targets = Sets.newHashSet("1", "2", "3");
+ private final Collection<String> targets = new HashSet<>(Arrays.asList("1", "2", "3"));
private StandardShardingStrategy standardShardingStrategy;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/TableRuleTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/TableRuleTest.java
index ffd2c77a91b..2dcf32cf38c 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/TableRuleTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/TableRuleTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.sharding.rule;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
import org.apache.shardingsphere.infra.datanode.DataNode;
@@ -33,6 +32,7 @@ import org.junit.Test;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -112,14 +112,14 @@ public final class TableRuleTest {
@Test
public void assertGetActualDatasourceNames() {
TableRule actual = new TableRule(new ShardingTableRuleConfiguration("LOGIC_TABLE", "ds${0..1}.table_${0..2}"), Arrays.asList("ds0", "ds1"), null);
- assertThat(actual.getActualDatasourceNames(), is(Sets.newLinkedHashSet(Arrays.asList("ds0", "ds1"))));
+ assertThat(actual.getActualDatasourceNames(), is(new LinkedHashSet<>(Arrays.asList("ds0", "ds1"))));
}
@Test
public void assertGetActualTableNames() {
TableRule actual = new TableRule(new ShardingTableRuleConfiguration("LOGIC_TABLE", "ds${0..1}.table_${0..2}"), Arrays.asList("ds0", "ds1"), null);
- assertThat(actual.getActualTableNames("ds0"), is(Sets.newLinkedHashSet(Arrays.asList("table_0", "table_1", "table_2"))));
- assertThat(actual.getActualTableNames("ds1"), is(Sets.newLinkedHashSet(Arrays.asList("table_0", "table_1", "table_2"))));
+ assertThat(actual.getActualTableNames("ds0"), is(new LinkedHashSet<>(Arrays.asList("table_0", "table_1", "table_2"))));
+ assertThat(actual.getActualTableNames("ds1"), is(new LinkedHashSet<>(Arrays.asList("table_0", "table_1", "table_2"))));
assertThat(actual.getActualTableNames("ds2"), is(Collections.emptySet()));
}
diff --git a/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java b/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java
index f7620626a30..a43c9dba678 100644
--- a/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/segment/table/TablesContextTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.binder.segment.table;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ColumnProjection;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
@@ -33,6 +32,7 @@ import org.junit.Test;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -50,7 +50,7 @@ public final class TablesContextTest {
public void assertGetTableNames() {
TablesContext tablesContext = new TablesContext(Arrays.asList(createTableSegment("table_1", "tbl_1"),
createTableSegment("table_2", "tbl_2")), DatabaseTypeEngine.getDatabaseType("MySQL"));
- assertThat(tablesContext.getTableNames(), is(Sets.newHashSet("table_1", "table_2")));
+ assertThat(tablesContext.getTableNames(), is(new HashSet<>(Arrays.asList("table_1", "table_2"))));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/statement/impl/InsertStatementContextTest.java b/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/statement/impl/InsertStatementContextTest.java
index dfe7c39a8b0..6050582f31e 100644
--- a/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/statement/impl/InsertStatementContextTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-binder/src/test/java/org/apache/shardingsphere/infra/binder/statement/impl/InsertStatementContextTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.binder.statement.impl;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.binder.statement.dml.InsertStatementContext;
import org.apache.shardingsphere.infra.database.DefaultDatabase;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
@@ -51,6 +50,7 @@ import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
@@ -181,7 +181,7 @@ public final class InsertStatementContextTest {
}
private void assertInsertStatementContext(final InsertStatementContext actual) {
- assertThat(actual.getTablesContext().getTableNames(), is(Sets.newLinkedHashSet(Collections.singletonList("tbl"))));
+ assertThat(actual.getTablesContext().getTableNames(), is(new HashSet<>(Collections.singleton("tbl"))));
assertThat(actual.getAllTables().size(), is(1));
SimpleTableSegment simpleTableSegment = actual.getAllTables().iterator().next();
assertThat(simpleTableSegment.getTableName().getStartIndex(), is(0));
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
index 95dad5cceee..5307fca8de4 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/OpenGaussDatabaseType.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.database.type.dialect;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.database.metadata.dialect.OpenGaussDataSourceMetaData;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
@@ -27,9 +26,11 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.tcl.RollbackSta
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
@@ -40,8 +41,8 @@ public final class OpenGaussDatabaseType implements DatabaseType {
private static final Map<String, Collection<String>> SYSTEM_DATABASE_SCHEMA_MAP = new HashMap<>();
- private static final Collection<String> SYSTEM_SCHEMAS = Sets.newHashSet("information_schema", "pg_catalog",
- "blockchain", "cstore", "db4ai", "dbe_perf", "dbe_pldebugger", "gaussdb", "oracle", "pkg_service", "snapshot", "sqladvisor");
+ private static final Collection<String> SYSTEM_SCHEMAS = new HashSet<>(Arrays.asList("information_schema", "pg_catalog",
+ "blockchain", "cstore", "db4ai", "dbe_perf", "dbe_pldebugger", "gaussdb", "oracle", "pkg_service", "snapshot", "sqladvisor"));
static {
SYSTEM_DATABASE_SCHEMA_MAP.put("postgres", SYSTEM_SCHEMAS);
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseType.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseType.java
index b06ba0be0a6..54ed38dd43d 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseType.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseType.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.database.type.dialect;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.database.metadata.dialect.PostgreSQLDataSourceMetaData;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
@@ -27,9 +26,11 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.tcl.RollbackSta
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
@@ -40,7 +41,7 @@ public final class PostgreSQLDatabaseType implements DatabaseType {
private static final Map<String, Collection<String>> SYSTEM_DATABASE_SCHEMA_MAP = new HashMap<>();
- private static final Collection<String> SYSTEM_SCHEMAS = Sets.newHashSet("information_schema", "pg_catalog");
+ private static final Collection<String> SYSTEM_SCHEMAS = new HashSet<>(Arrays.asList("information_schema", "pg_catalog"));
static {
SYSTEM_DATABASE_SCHEMA_MAP.put("postgres", SYSTEM_SCHEMAS);
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
index 3d94e3eb415..a491ae60188 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/datasource/pool/creator/DataSourceReflection.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.infra.datasource.pool.creator;
import com.google.common.base.CaseFormat;
-import com.google.common.collect.Sets;
import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
@@ -45,8 +44,9 @@ import java.util.Properties;
public final class DataSourceReflection {
static {
- GENERAL_CLASS_TYPES = Sets.newHashSet(boolean.class, Boolean.class, int.class, Integer.class, long.class, Long.class, String.class, Collection.class, List.class, Properties.class);
- SKIPPED_PROPERTY_KEYS = Sets.newHashSet("loginTimeout", "driverClassName");
+ GENERAL_CLASS_TYPES = new HashSet<>(
+ Arrays.asList(boolean.class, Boolean.class, int.class, Integer.class, long.class, Long.class, String.class, Collection.class, List.class, Properties.class));
+ SKIPPED_PROPERTY_KEYS = new HashSet<>(Arrays.asList("loginTimeout", "driverClassName"));
}
private static final Collection<Class<?>> GENERAL_CLASS_TYPES;
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRule.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRule.java
index f3bbc53c019..e634daa724d 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRule.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRule.java
@@ -17,13 +17,14 @@
package org.apache.shardingsphere.infra.metadata.schema.builder;
-import com.google.common.collect.Sets;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
/**
@@ -33,18 +34,18 @@ import java.util.Map;
@Getter
public enum SystemSchemaBuilderRule {
- MYSQL_INFORMATION_SCHEMA("MySQL", "information_schema", Sets.newHashSet("columns", "engines",
- "parameters", "routines", "schemata", "tables", "views")),
+ MYSQL_INFORMATION_SCHEMA("MySQL", "information_schema", new HashSet<>(Arrays.asList("columns", "engines",
+ "parameters", "routines", "schemata", "tables", "views"))),
- MYSQL_MYSQL("MySQL", "mysql", Sets.newHashSet("db")),
+ MYSQL_MYSQL("MySQL", "mysql", new HashSet<>(Collections.singleton("db"))),
- MYSQL_PERFORMANCE_SCHEMA("MySQL", "performance_schema", Sets.newHashSet("accounts")),
+ MYSQL_PERFORMANCE_SCHEMA("MySQL", "performance_schema", new HashSet<>(Collections.singleton("accounts"))),
- MYSQL_SYS("MySQL", "sys", Sets.newHashSet("sys")),
+ MYSQL_SYS("MySQL", "sys", new HashSet<>(Collections.singleton("sys"))),
- POSTGRESQL_INFORMATION_SCHEMA("PostgreSQL", "information_schema", Sets.newHashSet("columns", "tables", "views")),
+ POSTGRESQL_INFORMATION_SCHEMA("PostgreSQL", "information_schema", new HashSet<>(Arrays.asList("columns", "tables", "views"))),
- POSTGRESQL_PG_CATALOG("PostgreSQL", "pg_catalog", Sets.newHashSet("pg_class", "pg_database", "pg_inherits", "pg_tablespace", "pg_trigger")),
+ POSTGRESQL_PG_CATALOG("PostgreSQL", "pg_catalog", new HashSet<>(Arrays.asList("pg_class", "pg_database", "pg_inherits", "pg_tablespace", "pg_trigger"))),
OPEN_GAUSS_INFORMATION_SCHEMA("openGauss", "information_schema", Collections.emptySet()),
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseTypeTest.java
index 7508fefb2c4..31154acc66a 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/MySQLDatabaseTypeTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.infra.database.type.dialect;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.database.metadata.dialect.MySQLDataSourceMetaData;
import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
import org.junit.Test;
@@ -25,6 +24,7 @@ import org.junit.Test;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Arrays;
+import java.util.HashSet;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
@@ -79,6 +79,6 @@ public final class MySQLDatabaseTypeTest {
@Test
public void assertGetSystemSchemas() {
- assertThat(new MySQLDatabaseType().getSystemSchemas(), is(Sets.newHashSet("information_schema", "performance_schema", "mysql", "sys")));
+ assertThat(new MySQLDatabaseType().getSystemSchemas(), is(new HashSet<>(Arrays.asList("information_schema", "performance_schema", "mysql", "sys"))));
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseTypeTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseTypeTest.java
index db7e8bd6335..aec636b1542 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseTypeTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/database/type/dialect/PostgreSQLDatabaseTypeTest.java
@@ -17,14 +17,15 @@
package org.apache.shardingsphere.infra.database.type.dialect;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.database.metadata.dialect.PostgreSQLDataSourceMetaData;
import org.apache.shardingsphere.sql.parser.sql.common.constant.QuoteCharacter;
import org.junit.Test;
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
@@ -76,6 +77,6 @@ public final class PostgreSQLDatabaseTypeTest {
@Test
public void assertGetSystemSchemas() {
- assertThat(new PostgreSQLDatabaseType().getSystemSchemas(), is(Sets.newHashSet("information_schema", "pg_catalog")));
+ assertThat(new PostgreSQLDatabaseType().getSystemSchemas(), is(new HashSet<>(Arrays.asList("information_schema", "pg_catalog"))));
}
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/ShardingSphereSchemaTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/ShardingSphereSchemaTest.java
index 22851f599ee..f87af8e7a3e 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/ShardingSphereSchemaTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/ShardingSphereSchemaTest.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.infra.metadata.schema;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.metadata.schema.model.ColumnMetaData;
import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
import org.junit.Test;
import java.util.Collections;
+import java.util.HashSet;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertNull;
@@ -34,7 +34,7 @@ public final class ShardingSphereSchemaTest {
@Test
public void assertGetAllTableNames() {
- assertThat(new ShardingSphereSchema(Collections.singletonMap("tbl", mock(TableMetaData.class))).getAllTableNames(), is(Sets.newHashSet("tbl")));
+ assertThat(new ShardingSphereSchema(Collections.singletonMap("tbl", mock(TableMetaData.class))).getAllTableNames(), is(new HashSet<>(Collections.singleton("tbl"))));
}
@Test
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRuleTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRuleTest.java
index ec3fc58bbcb..138ce4220a7 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRuleTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SystemSchemaBuilderRuleTest.java
@@ -17,10 +17,12 @@
package org.apache.shardingsphere.infra.metadata.schema.builder;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.junit.Test;
+import java.util.Arrays;
+import java.util.HashSet;
+
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
@@ -32,7 +34,7 @@ public final class SystemSchemaBuilderRuleTest {
public void assertValueOfSchemaPathSuccess() {
SystemSchemaBuilderRule actual = SystemSchemaBuilderRule.valueOf(new MySQLDatabaseType().getType(), "information_schema");
assertThat(actual, is(SystemSchemaBuilderRule.MYSQL_INFORMATION_SCHEMA));
- assertThat(actual.getTables(), is(Sets.newHashSet("columns", "engines", "parameters", "routines", "schemata", "tables", "views")));
+ assertThat(actual.getTables(), is(new HashSet<>(Arrays.asList("columns", "engines", "parameters", "routines", "schemata", "tables", "views"))));
}
@Test(expected = IllegalArgumentException.class)
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/ConnectionManagerTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/ConnectionManagerTest.java
index b41c2177736..d4d06ed96c5 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/ConnectionManagerTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/connection/ConnectionManagerTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.driver.jdbc.core.connection;
-import com.google.common.collect.Sets;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.infra.database.DefaultDatabase;
import org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator;
@@ -147,7 +146,7 @@ public final class ConnectionManagerTest {
@Test
public void assertGetRandomPhysicalDataSourceNameFromContextManager() {
String actual = connectionManager.getRandomPhysicalDataSourceName();
- assertTrue(Sets.newHashSet("ds", "invalid_ds").contains(actual));
+ assertTrue(Arrays.asList("ds", "invalid_ds").contains(actual));
}
@Test
diff --git a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/SpringBootStarterTest.java b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/SpringBootStarterTest.java
index fbd6a57d9a5..4738944e9ec 100644
--- a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/SpringBootStarterTest.java
+++ b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-core-spring/shardingsphere-jdbc-core-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/SpringBootStarterTest.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.spring.boot;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
import org.apache.shardingsphere.encrypt.rule.EncryptTable;
@@ -97,7 +96,7 @@ public class SpringBootStarterTest {
}
private void assertShardingRule(final ShardingRule actual) {
- assertThat(actual.getDataSourceNames(), is(Sets.newHashSet("ds0", "ds1")));
+ assertThat(actual.getDataSourceNames(), is(new HashSet<>(Arrays.asList("ds0", "ds1"))));
InlineShardingAlgorithm databaseShardingAlgorithm = (InlineShardingAlgorithm) actual.getShardingAlgorithms().get("databaseShardingAlgorithm");
assertThat(databaseShardingAlgorithm.getProps().getProperty("algorithm-expression"), is("ds$->{user_id % 2}"));
InlineShardingAlgorithm orderTableShardingAlgorithm = (InlineShardingAlgorithm) actual.getShardingAlgorithms().get("orderTableShardingAlgorithm");
@@ -116,7 +115,7 @@ public class SpringBootStarterTest {
assertThat(actual.getLogicTable(), is("t_order"));
Collection<DataNode> dataNodes = Arrays.asList(new DataNode("ds0.t_order_0"), new DataNode("ds0.t_order_1"), new DataNode("ds1.t_order_0"), new DataNode("ds1.t_order_1"));
assertThat(actual.getActualDataNodes(), is(dataNodes));
- assertThat(actual.getActualDatasourceNames(), is(Sets.newHashSet("ds0", "ds1")));
+ assertThat(actual.getActualDatasourceNames(), is(new HashSet<>(Arrays.asList("ds0", "ds1"))));
assertThat(actual.getDataNodeGroups(), is(DataNodeUtil.getDataNodeGroups(dataNodes)));
assertThat(actual.getDatasourceToTablesMap(), is(getExpectedDatasourceToTablesMap()));
}
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilderTest.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilderTest.java
index 5088fc67703..4d065adb1eb 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilderTest.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/test/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilderTest.java
@@ -18,7 +18,6 @@
package org.apache.shardingsphere.data.pipeline.postgresql.sqlbuilder;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.data.pipeline.api.ingest.record.Column;
import org.apache.shardingsphere.data.pipeline.api.ingest.record.DataRecord;
import org.apache.shardingsphere.data.pipeline.api.metadata.LogicTableName;
@@ -27,6 +26,8 @@ import org.apache.shardingsphere.data.pipeline.postgresql.ingest.wal.decode.Post
import org.junit.Test;
import org.postgresql.replication.LogSequenceNumber;
+import java.util.Arrays;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -38,7 +39,7 @@ public final class PostgreSQLPipelineSQLBuilderTest {
private final PostgreSQLPipelineSQLBuilder sqlBuilder = new PostgreSQLPipelineSQLBuilder();
private final Map<LogicTableName, Set<String>> shardingColumnsMap = ImmutableMap.<LogicTableName, Set<String>>builder()
- .put(new LogicTableName("t_order"), Sets.newHashSet("order_id", "user_id")).build();
+ .put(new LogicTableName("t_order"), new HashSet<>(Arrays.asList("order_id", "user_id"))).build();
@Test
public void assertBuildInsertSQL() {
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/XATransactionDataSource.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/XATransactionData [...]
index 22c9de22797..cffce93cc41 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/XATransactionDataSource.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/XATransactionDataSource.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.transaction.xa.jta.datasource;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.transaction.xa.jta.connection.XAConnectionWrapperFactory;
import org.apache.shardingsphere.transaction.xa.spi.SingleXAResource;
@@ -33,7 +32,9 @@ import javax.transaction.Transaction;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.SQLException;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -42,7 +43,7 @@ import java.util.Set;
*/
public final class XATransactionDataSource implements AutoCloseable {
- private static final Set<String> CONTAINER_DATASOURCE_NAMES = Sets.newHashSet("AtomikosDataSourceBean", "BasicManagedDataSource");
+ private static final Set<String> CONTAINER_DATASOURCE_NAMES = new HashSet<>(Arrays.asList("AtomikosDataSourceBean", "BasicManagedDataSource"));
private final ThreadLocal<Map<Transaction, Connection>> enlistedTransactions = ThreadLocal.withInitial(HashMap::new);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLInformationSchemaExecutorFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLInformationSchemaExecutorFactory.java
index 3ee637c8437..4efe10868ac 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLInformationSchemaExecutorFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/admin/mysql/MySQLInformationSchemaExecutorFactory.java
@@ -17,14 +17,15 @@
package org.apache.shardingsphere.proxy.backend.text.admin.mysql;
-import com.google.common.collect.Sets;
import org.apache.shardingsphere.proxy.backend.text.admin.executor.AbstractDatabaseMetadataExecutor.DefaultDatabaseMetadataExecutor;
import org.apache.shardingsphere.proxy.backend.text.admin.executor.DatabaseAdminExecutor;
import org.apache.shardingsphere.proxy.backend.text.admin.mysql.executor.information.SelectInformationSchemataExecutor;
import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment;
import org.apache.shardingsphere.sql.parser.sql.common.statement.dml.SelectStatement;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Optional;
/**
@@ -34,7 +35,7 @@ public final class MySQLInformationSchemaExecutorFactory {
public static final String SCHEMATA_TABLE = "SCHEMATA";
- public static final Collection<String> DEFAULT_EXECUTOR_TABLES = Sets.newHashSet("ENGINES", "FILES", "VIEWS", "TRIGGERS", "PARTITIONS");
+ public static final Collection<String> DEFAULT_EXECUTOR_TABLES = new HashSet<>(Arrays.asList("ENGINES", "FILES", "VIEWS", "TRIGGERS", "PARTITIONS"));
/**
* Create executor.
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
index 3ea7108e4b8..16801b0e4c7 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/RuleDefinitionBackendHandler.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.proxy.backend.text.distsql.rdl.rule;
-import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.data.pipeline.scenario.rulealtered.RuleAlteredJobWorker;
import org.apache.shardingsphere.distsql.parser.statement.rdl.RuleDefinitionStatement;
@@ -46,7 +45,9 @@ import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterSharding
import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingTableRuleStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
@@ -58,8 +59,8 @@ import java.util.Set;
@Slf4j
public final class RuleDefinitionBackendHandler<T extends RuleDefinitionStatement> extends DatabaseRequiredBackendHandler<T> {
- private static final Set<String> RULE_ALTERED_ACTION_LIST = Sets.newHashSet(AlterShardingTableRuleStatement.class.getName(), AlterShardingAlgorithmStatement.class.getName(),
- AlterDefaultShardingStrategyStatement.class.getName(), AlterShardingBindingTableRulesStatement.class.getName(), AlterShardingBroadcastTableRulesStatement.class.getName());
+ private static final Set<String> RULE_ALTERED_ACTIONS = new HashSet<>(Arrays.asList(AlterShardingTableRuleStatement.class.getName(), AlterShardingAlgorithmStatement.class.getName(),
+ AlterDefaultShardingStrategyStatement.class.getName(), AlterShardingBindingTableRulesStatement.class.getName(), AlterShardingBroadcastTableRulesStatement.class.getName()));
public RuleDefinitionBackendHandler(final T sqlStatement, final ConnectionSession connectionSession) {
super(sqlStatement, connectionSession);
@@ -75,7 +76,7 @@ public final class RuleDefinitionBackendHandler<T extends RuleDefinitionStatemen
ruleDefinitionUpdater.checkSQLStatement(shardingSphereMetaData, sqlStatement, currentRuleConfig);
Optional<RuleDefinitionAlterPreprocessor> preprocessor = RuleDefinitionAlterPreprocessorFactory.findInstance(sqlStatement);
if (!RuleAlteredJobWorker.isOnRuleAlteredActionEnabled(currentRuleConfig)) {
- if (RULE_ALTERED_ACTION_LIST.contains(sqlStatement.getClass().getCanonicalName())) {
+ if (RULE_ALTERED_ACTIONS.contains(sqlStatement.getClass().getCanonicalName())) {
// TODO throw new RuntimeException("scaling is not enabled");
log.warn("rule altered and scaling is not enabled.");
}
diff --git a/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/mix/YamlShardingWithReadwriteSplittingIntegrateTest.java b/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/mix/YamlShardingWithReadwriteSplittingIntegrateTest.java
index d01cfd1f11a..c5cb85be373 100644
--- a/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/mix/YamlShardingWithReadwriteSplittingIntegrateTest.java
+++ b/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/mix/YamlShardingWithReadwriteSplittingIntegrateTest.java
@@ -17,8 +17,6 @@
package org.apache.shardingsphere.driver.mix;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.driver.AbstractYamlDataSourceTest;
import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
@@ -64,7 +62,11 @@ public final class YamlShardingWithReadwriteSplittingIntegrateTest extends Abstr
if (hasDataSource) {
dataSource = YamlShardingSphereDataSourceFactory.createDataSource(yamlFile);
} else {
- Map<String, DataSource> dataSourceMap = Maps.asMap(Sets.newHashSet("write_ds_0", "read_ds_0", "write_ds_1", "read_ds_1"), AbstractYamlDataSourceTest::createDataSource);
+ Map<String, DataSource> dataSourceMap = new HashMap<>(4, 1);
+ dataSourceMap.put("write_ds_0", createDataSource("write_ds_0"));
+ dataSourceMap.put("read_ds_0", createDataSource("read_ds_0"));
+ dataSourceMap.put("write_ds_1", createDataSource("write_ds_1"));
+ dataSourceMap.put("read_ds_1", createDataSource("read_ds_1"));
Map<String, DataSource> result = new HashMap<>(dataSourceMap.size(), 1);
for (Entry<String, DataSource> each : dataSourceMap.entrySet()) {
result.put(each.getKey(), each.getValue());
diff --git a/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/readwrite/YamlReadwriteSplittingIntegrateTest.java b/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/readwrite/YamlReadwriteSplittingIntegrateTest.java
index 02f05a36714..73db593efef 100644
--- a/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/readwrite/YamlReadwriteSplittingIntegrateTest.java
+++ b/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/readwrite/YamlReadwriteSplittingIntegrateTest.java
@@ -17,8 +17,6 @@
package org.apache.shardingsphere.driver.readwrite;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.driver.AbstractYamlDataSourceTest;
import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
@@ -34,6 +32,8 @@ import java.sql.Connection;
import java.sql.Statement;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Objects;
@RunWith(Parameterized.class)
@@ -61,8 +61,11 @@ public final class YamlReadwriteSplittingIntegrateTest extends AbstractYamlDataS
if (hasDataSource) {
dataSource = YamlShardingSphereDataSourceFactory.createDataSource(yamlFile);
} else {
- dataSource = YamlShardingSphereDataSourceFactory.createDataSource(
- Maps.asMap(Sets.newHashSet("db_write", "read_ds_0", "read_ds_1"), AbstractYamlDataSourceTest::createDataSource), yamlFile);
+ Map<String, DataSource> dataSourceMap = new HashMap<>(3, 1);
+ dataSourceMap.put("db_write", createDataSource("db_write"));
+ dataSourceMap.put("read_ds_0", createDataSource("read_ds_0"));
+ dataSourceMap.put("read_ds_1", createDataSource("read_ds_1"));
+ dataSource = YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap, yamlFile);
}
try (
Connection connection = dataSource.getConnection();
@@ -81,8 +84,11 @@ public final class YamlReadwriteSplittingIntegrateTest extends AbstractYamlDataS
if (hasDataSource) {
dataSource = YamlShardingSphereDataSourceFactory.createDataSource(yamlFile);
} else {
- dataSource = YamlShardingSphereDataSourceFactory.createDataSource(
- Maps.asMap(Sets.newHashSet("db_write", "read_ds_0", "read_ds_1"), AbstractYamlDataSourceTest::createDataSource), yamlFile);
+ Map<String, DataSource> dataSourceMap = new HashMap<>(3, 1);
+ dataSourceMap.put("db_write", createDataSource("db_write"));
+ dataSourceMap.put("read_ds_0", createDataSource("read_ds_0"));
+ dataSourceMap.put("read_ds_1", createDataSource("read_ds_1"));
+ dataSource = YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap, yamlFile);
}
try (
Connection connection = dataSource.getConnection();
diff --git a/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/sharding/YamlShardingIntegrateTest.java b/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/sharding/YamlShardingIntegrateTest.java
index 5bd525dce62..4bd8aa601a8 100644
--- a/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/sharding/YamlShardingIntegrateTest.java
+++ b/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/sharding/YamlShardingIntegrateTest.java
@@ -17,11 +17,9 @@
package org.apache.shardingsphere.driver.sharding;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
import org.apache.shardingsphere.driver.AbstractYamlDataSourceTest;
+import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
import org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,6 +32,8 @@ import java.sql.Connection;
import java.sql.Statement;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Objects;
@RunWith(Parameterized.class)
@@ -61,7 +61,10 @@ public class YamlShardingIntegrateTest extends AbstractYamlDataSourceTest {
if (hasDataSource) {
dataSource = YamlShardingSphereDataSourceFactory.createDataSource(yamlFile);
} else {
- dataSource = YamlShardingSphereDataSourceFactory.createDataSource(Maps.asMap(Sets.newHashSet("db0", "db1"), AbstractYamlDataSourceTest::createDataSource), yamlFile);
+ Map<String, DataSource> dataSourceMap = new HashMap<>(2, 1);
+ dataSourceMap.put("db0", createDataSource("db0"));
+ dataSourceMap.put("db1", createDataSource("db1"));
+ dataSource = YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap, yamlFile);
}
try (
Connection connection = dataSource.getConnection();
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
index 4d5b3995788..d2a065d4971 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.integration.data.pipeline.cases.base;
-import com.google.common.collect.Sets;
import com.zaxxer.hikari.HikariDataSource;
import lombok.AccessLevel;
import lombok.Getter;
@@ -49,7 +48,9 @@ import javax.xml.bind.JAXB;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -172,7 +173,7 @@ public abstract class BaseITCase {
protected void assertOriginalSourceSuccess() {
List<Map<String, Object>> previewResults = getJdbcTemplate().queryForList("PREVIEW SELECT COUNT(1) FROM t_order");
Set<Object> originalSources = previewResults.stream().map(each -> each.get("data_source_name")).collect(Collectors.toSet());
- assertThat(originalSources, is(Sets.newHashSet("ds_0", "ds_1")));
+ assertThat(originalSources, is(new HashSet<>(Arrays.asList("ds_0", "ds_1"))));
}
/**
@@ -216,7 +217,7 @@ public abstract class BaseITCase {
ThreadUtil.sleep(2000);
List<Map<String, Object>> previewResults = jdbcTemplate.queryForList("PREVIEW SELECT COUNT(1) FROM t_order");
Set<Object> originalSources = previewResults.stream().map(each -> each.get("data_source_name")).collect(Collectors.toSet());
- assertThat(originalSources, is(Sets.newHashSet("ds_2", "ds_3", "ds_4")));
+ assertThat(originalSources, is(new HashSet<>(Arrays.asList("ds_2", "ds_3", "ds_4"))));
}
@After
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/scenario/ScalingScenario.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/scenario/ScalingScenario.java
index 4c9aeb9dd63..fbacfe4b689 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/scenario/ScalingScenario.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/scenario/ScalingScenario.java
@@ -17,9 +17,9 @@
package org.apache.shardingsphere.integration.data.pipeline.cases.scenario;
-import com.google.common.collect.Sets;
-
import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
/**
* Manual scaling scenario.
@@ -34,6 +34,6 @@ public final class ScalingScenario {
* @return scenario list
*/
public static Collection<String> listScenario() {
- return Sets.newHashSet("integer_primary_key");
+ return new HashSet<>(Collections.singleton("integer_primary_key"));
}
}