You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/08/28 02:01:31 UTC
[shardingsphere] branch master updated: Revise code format for #20605 (#20606)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 c63bb19288d Revise code format for #20605 (#20606)
c63bb19288d is described below
commit c63bb19288d5b8417665d9f36a3ca07d5e4a2805
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun Aug 28 10:01:20 2022 +0800
Revise code format for #20605 (#20606)
---
.../keygen/CosIdKeyGenerateAlgorithmTest.java | 4 ++--
.../CosIdSnowflakeKeyGenerateAlgorithmTest.java | 20 ++++++++------------
.../DateCosIdIntervalShardingAlgorithmTest.java | 10 ++++++----
.../InstantCosIdIntervalShardingAlgorithmTest.java | 10 ++++++----
.../LocalDateCosIdIntervalShardingAlgorithmTest.java | 12 +++++++-----
...alDateTimeCosIdIntervalShardingAlgorithmTest.java | 10 ++++++----
...etDateTimeCosIdIntervalShardingAlgorithmTest.java | 10 ++++++----
...TimestampCosIdIntervalShardingAlgorithmTest.java} | 12 +++++++-----
.../SqlDateCosIdIntervalShardingAlgorithmTest.java | 10 ++++++----
.../StringCosIdIntervalShardingAlgorithmTest.java | 8 +++++---
.../TimestampCosIdIntervalShardingAlgorithmTest.java | 8 +++++---
.../YearMonthCosIdIntervalShardingAlgorithmTest.java | 20 +++++++++++---------
...edDateTimeCosIdIntervalShardingAlgorithmTest.java | 10 ++++++----
13 files changed, 81 insertions(+), 63 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdKeyGenerateAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdKeyGenerateAlgorithmTest.java
index 1776a011131..250cc32805e 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdKeyGenerateAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdKeyGenerateAlgorithmTest.java
@@ -77,8 +77,8 @@ public final class CosIdKeyGenerateAlgorithmTest {
public void assertGenerateKeyAsString() {
String idName = "test-cosid-as-string";
String prefix = "test_";
- IdGenerator stringIdGen = new StringIdGeneratorDecorator(new MillisecondSnowflakeId(1, 0), new PrefixIdConverter(prefix, Radix62IdConverter.INSTANCE));
- DefaultIdGeneratorProvider.INSTANCE.set(idName, stringIdGen);
+ IdGenerator idGeneratorDecorator = new StringIdGeneratorDecorator(new MillisecondSnowflakeId(1, 0), new PrefixIdConverter(prefix, Radix62IdConverter.INSTANCE));
+ DefaultIdGeneratorProvider.INSTANCE.set(idName, idGeneratorDecorator);
KeyGenerateAlgorithm algorithm = KeyGenerateAlgorithmFactory.newInstance(new AlgorithmConfiguration("COSID", createAsStringProperties(idName)));
Comparable<?> actual = algorithm.generateKey();
assertThat(actual, instanceOf(String.class));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdSnowflakeKeyGenerateAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdSnowflakeKeyGenerateAlgorithmTest.java
index c33df22023f..e53765b42dc 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdSnowflakeKeyGenerateAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdSnowflakeKeyGenerateAlgorithmTest.java
@@ -17,9 +17,6 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.keygen;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.locks.LockSupport;
-
import me.ahoo.cosid.converter.Radix62IdConverter;
import me.ahoo.cosid.snowflake.MillisecondSnowflakeId;
import me.ahoo.cosid.snowflake.MillisecondSnowflakeIdStateParser;
@@ -27,17 +24,18 @@ import me.ahoo.cosid.snowflake.SnowflakeIdState;
import me.ahoo.cosid.snowflake.SnowflakeIdStateParser;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
-import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
import org.apache.shardingsphere.infra.lock.LockContext;
+import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
import org.apache.shardingsphere.sharding.cosid.algorithm.keygen.fixture.WorkerIdGeneratorFixture;
import org.apache.shardingsphere.sharding.factory.KeyGenerateAlgorithmFactory;
-import org.hamcrest.MatcherAssert;
import org.junit.Test;
import java.util.Properties;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.locks.LockSupport;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
@@ -76,15 +74,13 @@ public final class CosIdSnowflakeKeyGenerateAlgorithmTest {
@Test
public void assertGenerateKeyModUniformity() {
- CosIdSnowflakeKeyGenerateAlgorithm algorithm = (CosIdSnowflakeKeyGenerateAlgorithm) KeyGenerateAlgorithmFactory.newInstance(
- new AlgorithmConfiguration("COSID_SNOWFLAKE", new Properties()));
+ CosIdSnowflakeKeyGenerateAlgorithm algorithm = (CosIdSnowflakeKeyGenerateAlgorithm) KeyGenerateAlgorithmFactory.newInstance(new AlgorithmConfiguration("COSID_SNOWFLAKE", new Properties()));
algorithm.setInstanceContext(new InstanceContext(new ComputeNodeInstance(mock(InstanceMetaData.class)), new WorkerIdGeneratorFixture(FIXTURE_WORKER_ID),
new ModeConfiguration("Standalone", null, false), mock(LockContext.class), eventBusContext));
int divisor = 4;
int total = 99999;
int avg = total / divisor;
double tolerance = avg * .0015;
-
int mod0Counter = 0;
int mod1Counter = 0;
int mod2Counter = 0;
@@ -111,10 +107,10 @@ public final class CosIdSnowflakeKeyGenerateAlgorithmTest {
int wait = ThreadLocalRandom.current().nextInt(10, 1000);
LockSupport.parkNanos(wait);
}
- MatcherAssert.assertThat((double) mod0Counter, closeTo(avg, tolerance));
- MatcherAssert.assertThat((double) mod1Counter, closeTo(avg, tolerance));
- MatcherAssert.assertThat((double) mod2Counter, closeTo(avg, tolerance));
- MatcherAssert.assertThat((double) mod3Counter, closeTo(avg, tolerance));
+ assertThat((double) mod0Counter, closeTo(avg, tolerance));
+ assertThat((double) mod1Counter, closeTo(avg, tolerance));
+ assertThat((double) mod2Counter, closeTo(avg, tolerance));
+ assertThat((double) mod3Counter, closeTo(avg, tolerance));
}
@Test
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/DateCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/DateCosIdIntervalShardingAlgorithmTest.java
index 48c6ff56453..45ca4b13f96 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/DateCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/DateCosIdIntervalShardingAlgorithmTest.java
@@ -18,12 +18,14 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.util.Collection;
-import java.util.Date;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.util.Collection;
+import java.util.Date;
public final class DateCosIdIntervalShardingAlgorithmTest {
@@ -42,7 +44,7 @@ public final class DateCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsDate();
}
@@ -60,7 +62,7 @@ public final class DateCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsDate();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/InstantCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/InstantCosIdIntervalShardingAlgorithmTest.java
index 19c3bc0e19c..3d6241c2894 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/InstantCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/InstantCosIdIntervalShardingAlgorithmTest.java
@@ -18,12 +18,14 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.time.Instant;
-import java.util.Collection;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.time.Instant;
+import java.util.Collection;
public final class InstantCosIdIntervalShardingAlgorithmTest {
@@ -42,7 +44,7 @@ public final class InstantCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsInstant();
}
@@ -60,7 +62,7 @@ public final class InstantCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsInstant();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateCosIdIntervalShardingAlgorithmTest.java
index 63adc443485..a8d24cbe657 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateCosIdIntervalShardingAlgorithmTest.java
@@ -18,13 +18,15 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.util.Collection;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.Collection;
public final class LocalDateCosIdIntervalShardingAlgorithmTest {
@@ -43,7 +45,7 @@ public final class LocalDateCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsLocalDate();
}
@@ -61,7 +63,7 @@ public final class LocalDateCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsLocalDate();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateTimeCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateTimeCosIdIntervalShardingAlgorit [...]
index 05e368c80b5..105cfd91c47 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateTimeCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateTimeCosIdIntervalShardingAlgorithmTest.java
@@ -18,12 +18,14 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.time.LocalDateTime;
-import java.util.Collection;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.time.LocalDateTime;
+import java.util.Collection;
public final class LocalDateTimeCosIdIntervalShardingAlgorithmTest {
@@ -42,7 +44,7 @@ public final class LocalDateTimeCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsLocalDateTime();
}
@@ -60,7 +62,7 @@ public final class LocalDateTimeCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsLocalDateTime();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/OffsetDateTimeCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/OffsetDateTimeCosIdIntervalShardingAlgor [...]
index e9b2e300dad..1ece32ac8b8 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/OffsetDateTimeCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/OffsetDateTimeCosIdIntervalShardingAlgorithmTest.java
@@ -18,12 +18,14 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.time.OffsetDateTime;
-import java.util.Collection;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.time.OffsetDateTime;
+import java.util.Collection;
public final class OffsetDateTimeCosIdIntervalShardingAlgorithmTest {
@@ -42,7 +44,7 @@ public final class OffsetDateTimeCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsOffsetDateTime();
}
@@ -60,7 +62,7 @@ public final class OffsetDateTimeCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsOffsetDateTime();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlTimestampCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SQLTimestampCosIdIntervalShardingAlgorithm [...]
similarity index 92%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlTimestampCosIdIntervalShardingAlgorithmTest.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SQLTimestampCosIdIntervalShardingAlgorithmTest.java
index 21814f3b05d..7884f8b69b6 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlTimestampCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SQLTimestampCosIdIntervalShardingAlgorithmTest.java
@@ -18,14 +18,16 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.sql.Timestamp;
-import java.util.Collection;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.Timestamp;
+import java.util.Collection;
-public final class SqlTimestampCosIdIntervalShardingAlgorithmTest {
+public final class SQLTimestampCosIdIntervalShardingAlgorithmTest {
static Iterable<Object[]> preciseArgsProviderAsTimestamp() {
return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> new Timestamp(ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli()));
@@ -42,7 +44,7 @@ public final class SqlTimestampCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsTimestamp();
}
@@ -60,7 +62,7 @@ public final class SqlTimestampCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsTimestamp();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlDateCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlDateCosIdIntervalShardingAlgorithmTest.java
index 1a30dfb52b5..1b87311bfb7 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlDateCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlDateCosIdIntervalShardingAlgorithmTest.java
@@ -18,12 +18,14 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.util.Collection;
-import java.sql.Date;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.Date;
+import java.util.Collection;
public final class SqlDateCosIdIntervalShardingAlgorithmTest {
@@ -42,7 +44,7 @@ public final class SqlDateCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsDate();
}
@@ -60,7 +62,7 @@ public final class SqlDateCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsDate();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/StringCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/StringCosIdIntervalShardingAlgorithmTest.java
index 73d30ce0d8d..77a3734dcc7 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/StringCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/StringCosIdIntervalShardingAlgorithmTest.java
@@ -18,11 +18,13 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.util.Collection;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.util.Collection;
public final class StringCosIdIntervalShardingAlgorithmTest {
@@ -41,7 +43,7 @@ public final class StringCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsString();
}
@@ -59,7 +61,7 @@ public final class StringCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsString();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/TimestampCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/TimestampCosIdIntervalShardingAlgorithmTest.java
index 0a608f37d97..a1033f301e6 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/TimestampCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/TimestampCosIdIntervalShardingAlgorithmTest.java
@@ -18,11 +18,13 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.util.Collection;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.util.Collection;
public final class TimestampCosIdIntervalShardingAlgorithmTest {
@@ -41,7 +43,7 @@ public final class TimestampCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsTimestamp();
}
@@ -59,7 +61,7 @@ public final class TimestampCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsTimestamp();
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/YearMonthCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/YearMonthCosIdIntervalShardingAlgorithmTest.java
index 6be0cb64031..c189d04f130 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/YearMonthCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/YearMonthCosIdIntervalShardingAlgorithmTest.java
@@ -18,15 +18,17 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.time.YearMonth;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
import me.ahoo.cosid.sharding.ExactCollection;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.time.YearMonth;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
public final class YearMonthCosIdIntervalShardingAlgorithmTest {
@@ -45,7 +47,7 @@ public final class YearMonthCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsYearMonth();
}
@@ -63,9 +65,9 @@ public final class YearMonthCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
- List<Object[]> args = new LinkedList<>();
+ List<Object[]> result = new LinkedList<>();
Iterable<Object[]> iterable = rangeArgsProviderAsYearMonth();
iterable.forEach(each -> {
Range<YearMonth> shardingValue = (Range<YearMonth>) each[0];
@@ -73,9 +75,9 @@ public final class YearMonthCosIdIntervalShardingAlgorithmTest {
if (shardingValue.equals(Range.lessThan(YearMonth.of(2021, 5)))) {
expect = new ExactCollection<>("table_202101", "table_202102", "table_202103", "table_202104");
}
- args.add(new Object[]{shardingValue, expect});
+ result.add(new Object[]{shardingValue, expect});
});
- return args;
+ return result;
}
@Test
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/ZonedDateTimeCosIdIntervalShardingAlgorithmTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/ZonedDateTimeCosIdIntervalShardingAlgorit [...]
index ea4c3ecc882..a63139aa766 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/ZonedDateTimeCosIdIntervalShardingAlgorithmTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-plugin/shardingsphere-sharding-cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/ZonedDateTimeCosIdIntervalShardingAlgorithmTest.java
@@ -18,12 +18,14 @@
package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
import com.google.common.collect.Range;
-import java.time.ZonedDateTime;
-import java.util.Collection;
import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.time.ZonedDateTime;
+import java.util.Collection;
public final class ZonedDateTimeCosIdIntervalShardingAlgorithmTest {
@@ -42,7 +44,7 @@ public final class ZonedDateTimeCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return preciseArgsProviderAsZonedDateTime();
}
@@ -60,7 +62,7 @@ public final class ZonedDateTimeCosIdIntervalShardingAlgorithmTest {
super(input, expected);
}
- @Parameterized.Parameters(name = "{index}: doSharding({0})={1}")
+ @Parameters(name = "{index}: doSharding({0})={1}")
public static Iterable<Object[]> argsProvider() {
return rangeArgsProviderAsZonedDateTime();
}