This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 217635e6611 Refactor usage of PropertiesBuilder.Property (#36248)
217635e6611 is described below
commit 217635e66115ee946c290ec2963d2f7f487fed8f
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Aug 11 16:35:53 2025 +0800
Refactor usage of PropertiesBuilder.Property (#36248)
* Refactor usage of PropertiesBuilder.Property
* Refactor usage of PropertiesBuilder.Property
---
.../algorithm/standard/AESEncryptAlgorithm.java | 2 +-
...ttingRuleConfigurationToDistSQLConverterTest.java | 3 ++-
...rdingRuleConfigurationToDistSQLConverterTest.java | 3 ++-
.../aes/props/DefaultAESPropertiesProviderTest.java | 3 ++-
.../ClickHouseConnectionPropertiesParserTest.java | 3 ++-
.../FirebirdConnectionPropertiesParserTest.java | 13 +++++++------
.../espresso/EspressoInlineExpressionParserTest.java | 3 ++-
.../groovy/GroovyInlineExpressionParserTest.java | 20 ++++++++------------
.../interval/IntervalInlineExpressionParserTest.java | 3 ++-
.../literal/LiteralInlineExpressionParserTest.java | 6 +++---
.../ratelimit/type/QPSJobRateLimitAlgorithmTest.java | 5 +++--
.../ratelimit/type/TPSJobRateLimitAlgorithmTest.java | 5 +++--
12 files changed, 37 insertions(+), 32 deletions(-)
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java
index 48a84a28c73..800317ede5a 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java
@@ -66,7 +66,7 @@ public final class AESEncryptAlgorithm implements
EncryptAlgorithm {
@Override
public AlgorithmConfiguration toConfiguration() {
return new AlgorithmConfiguration(getType(),
- PropertiesBuilder.build(new Property(AES_KEY,
this.props.getProperty(AES_KEY)), new Property(DIGEST_ALGORITHM_NAME,
StringUtils.upperCase(props.getProperty(DIGEST_ALGORITHM_NAME)))));
+ PropertiesBuilder.build(new Property(AES_KEY,
props.getProperty(AES_KEY)), new Property(DIGEST_ALGORITHM_NAME,
StringUtils.upperCase(props.getProperty(DIGEST_ALGORITHM_NAME)))));
}
@Override
diff --git
a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/converter/ReadwriteSplittingRuleConfigurationToDistSQLConverterTest.java
b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/converter/ReadwriteSplittingRuleConfigurationToDistSQLConverterTest.java
index 3dd76ffb604..3d4c5bae0ce 100644
---
a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/converter/ReadwriteSplittingRuleConfigurationToDistSQLConverterTest.java
+++
b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/converter/ReadwriteSplittingRuleConfigurationToDistSQLConverterTest.java
@@ -21,6 +21,7 @@ import
org.apache.shardingsphere.distsql.handler.engine.query.ral.convert.RuleCo
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import
org.apache.shardingsphere.readwritesplitting.config.ReadwriteSplittingRuleConfiguration;
import
org.apache.shardingsphere.readwritesplitting.config.rule.ReadwriteSplittingDataSourceGroupRuleConfiguration;
import org.junit.jupiter.api.Test;
@@ -74,6 +75,6 @@ class
ReadwriteSplittingRuleConfigurationToDistSQLConverterTest {
ReadwriteSplittingDataSourceGroupRuleConfiguration
dataSourceGroupConfig1 = new ReadwriteSplittingDataSourceGroupRuleConfiguration(
"bar_ds", "ds_primary", Arrays.asList("ds_slave_0",
"ds_slave_1"), "not_existed");
return new
ReadwriteSplittingRuleConfiguration(Arrays.asList(dataSourceGroupConfig0,
dataSourceGroupConfig1),
- Collections.singletonMap("test", new
AlgorithmConfiguration("random", PropertiesBuilder.build(new
PropertiesBuilder.Property("read_weight", "2:1")))));
+ Collections.singletonMap("test", new
AlgorithmConfiguration("random", PropertiesBuilder.build(new
Property("read_weight", "2:1")))));
}
}
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/converter/ShardingRuleConfigurationToDistSQLConverterTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/converter/ShardingRuleConfigurationToDistSQLConverterTest.java
index 49845fdf4ee..07da127ccd5 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/converter/ShardingRuleConfigurationToDistSQLConverterTest.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/handler/converter/ShardingRuleConfigurationToDistSQLConverterTest.java
@@ -21,6 +21,7 @@ import
org.apache.shardingsphere.distsql.handler.engine.query.ral.convert.RuleCo
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.audit.ShardingAuditStrategyConfiguration;
@@ -79,7 +80,7 @@ class ShardingRuleConfigurationToDistSQLConverterTest {
}
private AlgorithmConfiguration
createShardingInlineAlgorithmConfiguration(final String algorithmExpression) {
- return new AlgorithmConfiguration("INLINE",
PropertiesBuilder.build(new PropertiesBuilder.Property("algorithm-expression",
algorithmExpression)));
+ return new AlgorithmConfiguration("INLINE",
PropertiesBuilder.build(new Property("algorithm-expression",
algorithmExpression)));
}
private AlgorithmConfiguration createKeyGeneratorConfiguration() {
diff --git
a/infra/algorithm/type/cryptographic/type/aes/src/test/java/org/apache/shardingsphere/infra/algorithm/cryptographic/aes/props/DefaultAESPropertiesProviderTest.java
b/infra/algorithm/type/cryptographic/type/aes/src/test/java/org/apache/shardingsphere/infra/algorithm/cryptographic/aes/props/DefaultAESPropertiesProviderTest.java
index 9b73253fe07..83caffdac3e 100644
---
a/infra/algorithm/type/cryptographic/type/aes/src/test/java/org/apache/shardingsphere/infra/algorithm/cryptographic/aes/props/DefaultAESPropertiesProviderTest.java
+++
b/infra/algorithm/type/cryptographic/type/aes/src/test/java/org/apache/shardingsphere/infra/algorithm/cryptographic/aes/props/DefaultAESPropertiesProviderTest.java
@@ -21,6 +21,7 @@ import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitial
import
org.apache.shardingsphere.infra.algorithm.cryptographic.core.CryptographicPropertiesProvider;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.is;
@@ -37,7 +38,7 @@ class DefaultAESPropertiesProviderTest {
@Test
void assertCreateNewInstanceWithAESKey() {
CryptographicPropertiesProvider provider =
TypedSPILoader.getService(CryptographicPropertiesProvider.class, "DEFAULT",
- PropertiesBuilder.build(new
PropertiesBuilder.Property("aes-key-value", "test"), new
PropertiesBuilder.Property("digest-algorithm-name", "SHA-1")));
+ PropertiesBuilder.build(new Property("aes-key-value", "test"),
new Property("digest-algorithm-name", "SHA-1")));
assertThat(provider.getSecretKey().length, is(16));
assertThat(provider.getMode(), is(""));
assertThat(provider.getPadding(), is(""));
diff --git
a/infra/database/type/clickhouse/src/test/java/org/apache/shardingsphere/infra/database/clickhouse/connector/ClickHouseConnectionPropertiesParserTest.java
b/infra/database/type/clickhouse/src/test/java/org/apache/shardingsphere/infra/database/clickhouse/connector/ClickHouseConnectionPropertiesParserTest.java
index f9c074831d3..7f66aeae49e 100644
---
a/infra/database/type/clickhouse/src/test/java/org/apache/shardingsphere/infra/database/clickhouse/connector/ClickHouseConnectionPropertiesParserTest.java
+++
b/infra/database/type/clickhouse/src/test/java/org/apache/shardingsphere/infra/database/clickhouse/connector/ClickHouseConnectionPropertiesParserTest.java
@@ -24,6 +24,7 @@ import
org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
@@ -66,7 +67,7 @@ class ClickHouseConnectionPropertiesParserTest {
return Stream.of(
Arguments.of("simple", "jdbc:ch://127.0.0.1/foo_ds",
"127.0.0.1", 8123, "foo_ds", null, new Properties()),
Arguments.of("complex",
"jdbc:clickhouse:http://127.0.0.1:9999/foo_ds?continueBatchOnError=true",
"127.0.0.1", 9999, "foo_ds", null,
- PropertiesBuilder.build(new
PropertiesBuilder.Property("continueBatchOnError", "true"))));
+ PropertiesBuilder.build(new
Property("continueBatchOnError", "true"))));
}
}
}
diff --git
a/infra/database/type/firebird/src/test/java/org/apache/shardingsphere/infra/database/firebird/connector/FirebirdConnectionPropertiesParserTest.java
b/infra/database/type/firebird/src/test/java/org/apache/shardingsphere/infra/database/firebird/connector/FirebirdConnectionPropertiesParserTest.java
index 9f9d6bdf89e..718380ba5c9 100644
---
a/infra/database/type/firebird/src/test/java/org/apache/shardingsphere/infra/database/firebird/connector/FirebirdConnectionPropertiesParserTest.java
+++
b/infra/database/type/firebird/src/test/java/org/apache/shardingsphere/infra/database/firebird/connector/FirebirdConnectionPropertiesParserTest.java
@@ -23,6 +23,7 @@ import
org.apache.shardingsphere.infra.database.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
@@ -70,16 +71,16 @@ class FirebirdConnectionPropertiesParserTest {
Arguments.of("simple_second",
"jdbc:firebird://localhost:32783//var/lib/firebird/data/demo_ds_2.fdb",
"localhost", 32783,
"/var/lib/firebird/data/demo_ds_2.fdb", null, new Properties()),
Arguments.of("simple_third",
"jdbc:firebirdsql://localhost/database?socket_buffer_size=32767", "localhost",
3050, "database", null, PropertiesBuilder.build(
- new PropertiesBuilder.Property("socketBufferSize",
"32767"))),
+ new Property("socketBufferSize", "32767"))),
Arguments.of("complex",
"jdbc:firebirdsql://localhost/database?socket_buffer_size=32767"
+
"&TRANSACTION_REPEATABLE_READ=concurrency,write,no_wait&columnLabelForName&soTimeout=1000&nonStandard2=value2",
"localhost", 3050, "database", null,
PropertiesBuilder.build(
- new
PropertiesBuilder.Property("socketBufferSize", "32767"),
- new
PropertiesBuilder.Property("TRANSACTION_REPEATABLE_READ",
"concurrency,write,no_wait"),
- new
PropertiesBuilder.Property("columnLabelForName", ""),
- new
PropertiesBuilder.Property("soTimeout", "1000"),
- new
PropertiesBuilder.Property("nonStandard2", "value2"))));
+ new Property("socketBufferSize", "32767"),
+ new
Property("TRANSACTION_REPEATABLE_READ", "concurrency,write,no_wait"),
+ new Property("columnLabelForName", ""),
+ new Property("soTimeout", "1000"),
+ new Property("nonStandard2", "value2"))));
}
}
}
diff --git
a/infra/expr/type/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
b/infra/expr/type/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
index 4e18fac209d..d6be43f7f77 100644
---
a/infra/expr/type/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
+++
b/infra/expr/type/espresso/src/test/java/org/apache/shardingsphere/infra/expr/espresso/EspressoInlineExpressionParserTest.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.infra.expr.espresso;
import org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.junit.jupiter.api.condition.EnabledOnJre;
@@ -126,6 +127,6 @@ class EspressoInlineExpressionParserTest {
}
private InlineExpressionParser getInlineExpressionParser(final String
expression) {
- return TypedSPILoader.getService(InlineExpressionParser.class,
"ESPRESSO", PropertiesBuilder.build(new
PropertiesBuilder.Property(InlineExpressionParser.INLINE_EXPRESSION_KEY,
expression)));
+ return TypedSPILoader.getService(InlineExpressionParser.class,
"ESPRESSO", PropertiesBuilder.build(new
Property(InlineExpressionParser.INLINE_EXPRESSION_KEY, expression)));
}
}
diff --git
a/infra/expr/type/groovy/src/test/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParserTest.java
b/infra/expr/type/groovy/src/test/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParserTest.java
index ac42c94cc9b..c58b5775671 100644
---
a/infra/expr/type/groovy/src/test/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParserTest.java
+++
b/infra/expr/type/groovy/src/test/java/org/apache/shardingsphere/infra/expr/groovy/GroovyInlineExpressionParserTest.java
@@ -21,17 +21,18 @@ import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
@@ -120,23 +121,18 @@ class GroovyInlineExpressionParserTest {
@Test
void assertEvaluateWithArgsExpression() {
- assertThat(getInlineExpressionParser("${1+2}").evaluateWithArgs(new
LinkedHashMap<>()), is("3"));
+
assertThat(getInlineExpressionParser("${1+2}").evaluateWithArgs(Collections.emptyMap()),
is("3"));
}
@Test
@SneakyThrows({ExecutionException.class, InterruptedException.class})
void assertEvaluateForThreadSafety() {
int threadCount = 10;
- ExecutorService pool = Executors.newFixedThreadPool(threadCount);
- List<Future<?>> futures = new ArrayList<>(threadCount);
- for (int i = 0; i < threadCount; i++) {
- Future<?> future =
pool.submit(this::createInlineExpressionParseTask);
- futures.add(future);
- }
- for (Future<?> future : futures) {
+ ExecutorService executorService =
Executors.newFixedThreadPool(threadCount);
+ for (Future<?> future : IntStream.range(0, threadCount).mapToObj(i ->
executorService.submit(this::createInlineExpressionParseTask)).collect(Collectors.toList()))
{
future.get();
}
- pool.shutdown();
+ executorService.shutdown();
}
private void createInlineExpressionParseTask() {
@@ -150,6 +146,6 @@ class GroovyInlineExpressionParserTest {
}
private InlineExpressionParser getInlineExpressionParser(final String
expression) {
- return TypedSPILoader.getService(InlineExpressionParser.class,
"GROOVY", PropertiesBuilder.build(new
PropertiesBuilder.Property(InlineExpressionParser.INLINE_EXPRESSION_KEY,
expression)));
+ return TypedSPILoader.getService(InlineExpressionParser.class,
"GROOVY", PropertiesBuilder.build(new
Property(InlineExpressionParser.INLINE_EXPRESSION_KEY, expression)));
}
}
diff --git
a/infra/expr/type/interval/src/test/java/org/apache/shardingsphere/infra/expr/interval/IntervalInlineExpressionParserTest.java
b/infra/expr/type/interval/src/test/java/org/apache/shardingsphere/infra/expr/interval/IntervalInlineExpressionParserTest.java
index ccd21127dc6..c894fcf65f1 100644
---
a/infra/expr/type/interval/src/test/java/org/apache/shardingsphere/infra/expr/interval/IntervalInlineExpressionParserTest.java
+++
b/infra/expr/type/interval/src/test/java/org/apache/shardingsphere/infra/expr/interval/IntervalInlineExpressionParserTest.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.infra.expr.interval;
import org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
@@ -109,6 +110,6 @@ class IntervalInlineExpressionParserTest {
}
private InlineExpressionParser getInlineExpressionParser(final String
expression) {
- return TypedSPILoader.getService(InlineExpressionParser.class,
"INTERVAL", PropertiesBuilder.build(new
PropertiesBuilder.Property(InlineExpressionParser.INLINE_EXPRESSION_KEY,
expression)));
+ return TypedSPILoader.getService(InlineExpressionParser.class,
"INTERVAL", PropertiesBuilder.build(new
Property(InlineExpressionParser.INLINE_EXPRESSION_KEY, expression)));
}
}
diff --git
a/infra/expr/type/literal/src/test/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParserTest.java
b/infra/expr/type/literal/src/test/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParserTest.java
index 1cc2a5a4965..f5b85e17bd8 100644
---
a/infra/expr/type/literal/src/test/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParserTest.java
+++
b/infra/expr/type/literal/src/test/java/org/apache/shardingsphere/infra/expr/literal/LiteralInlineExpressionParserTest.java
@@ -20,11 +20,11 @@ package org.apache.shardingsphere.infra.expr.literal;
import org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
-import java.util.LinkedHashMap;
import java.util.List;
import static org.hamcrest.CoreMatchers.hasItems;
@@ -79,10 +79,10 @@ class LiteralInlineExpressionParserTest {
@Test
void assertEvaluateWithArgumentsExpression() {
- assertThrows(UnsupportedOperationException.class, () ->
getInlineExpressionParser("${1+2}").evaluateWithArgs(new LinkedHashMap<>()));
+ assertThrows(UnsupportedOperationException.class, () ->
getInlineExpressionParser("${1+2}").evaluateWithArgs(Collections.emptyMap()));
}
private InlineExpressionParser getInlineExpressionParser(final String
expression) {
- return TypedSPILoader.getService(InlineExpressionParser.class,
"LITERAL", PropertiesBuilder.build(new
PropertiesBuilder.Property(InlineExpressionParser.INLINE_EXPRESSION_KEY,
expression)));
+ return TypedSPILoader.getService(InlineExpressionParser.class,
"LITERAL", PropertiesBuilder.build(new
Property(InlineExpressionParser.INLINE_EXPRESSION_KEY, expression)));
}
}
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/QPSJobRateLimitAlgorithmTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/QPSJobRateLimitAlgorithmTest.java
index 92d2ddbfc81..0153cbf0e00 100644
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/QPSJobRateLimitAlgorithmTest.java
+++
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/QPSJobRateLimitAlgorithmTest.java
@@ -22,6 +22,7 @@ import
org.apache.shardingsphere.data.pipeline.core.ratelimit.JobRateLimitAlgori
import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
import java.util.Properties;
@@ -35,13 +36,13 @@ class QPSJobRateLimitAlgorithmTest {
@Test
void assertInitFailed() {
- Properties props = PropertiesBuilder.build(new
PropertiesBuilder.Property("tps", "0"));
+ Properties props = PropertiesBuilder.build(new Property("tps", "0"));
assertThrows(AlgorithmInitializationException.class, () ->
TypedSPILoader.getService(JobRateLimitAlgorithm.class, "TPS", props));
}
@Test
void assertInitSuccess() {
- Properties props = PropertiesBuilder.build(new
PropertiesBuilder.Property("tps", "1"));
+ Properties props = PropertiesBuilder.build(new Property("tps", "1"));
assertDoesNotThrow(() ->
TypedSPILoader.getService(JobRateLimitAlgorithm.class, "TPS", props));
}
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/TPSJobRateLimitAlgorithmTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/TPSJobRateLimitAlgorithmTest.java
index d2644e40d8f..e1b34b20a86 100644
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/TPSJobRateLimitAlgorithmTest.java
+++
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/TPSJobRateLimitAlgorithmTest.java
@@ -22,6 +22,7 @@ import
org.apache.shardingsphere.data.pipeline.core.ratelimit.JobRateLimitAlgori
import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.infra.util.props.PropertiesBuilder;
+import org.apache.shardingsphere.infra.util.props.PropertiesBuilder.Property;
import org.junit.jupiter.api.Test;
import java.util.Properties;
@@ -35,13 +36,13 @@ class TPSJobRateLimitAlgorithmTest {
@Test
void assertInitFailed() {
- Properties props = PropertiesBuilder.build(new
PropertiesBuilder.Property("tps", "0"));
+ Properties props = PropertiesBuilder.build(new Property("tps", "0"));
assertThrows(AlgorithmInitializationException.class, () ->
TypedSPILoader.getService(JobRateLimitAlgorithm.class, "TPS", props));
}
@Test
void assertInitSuccess() {
- Properties props = PropertiesBuilder.build(new
PropertiesBuilder.Property("tps", "1"));
+ Properties props = PropertiesBuilder.build(new Property("tps", "1"));
assertDoesNotThrow(() ->
TypedSPILoader.getService(JobRateLimitAlgorithm.class, "TPS", props));
}