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 2023/03/11 10:23:40 UTC
[shardingsphere] branch master updated: Remove cosId sharding test cases (#24552)
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 8a74f1a489c Remove cosId sharding test cases (#24552)
8a74f1a489c is described below
commit 8a74f1a489ce38678cfd757af166ad2927d59e28
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Mar 11 18:23:33 2023 +0800
Remove cosId sharding test cases (#24552)
* Rename LocalDateTimeConvertor to CosIdLocalDateTimeConvertor
* Remove cosId sharding test cases
---
.../sharding/cosid/algorithm/Arguments.java | 51 -------
...tractPreciseShardingValueParameterizedTest.java | 54 -------
...bstractRangeShardingValueParameterizedTest.java | 58 --------
...osIdSnowflakeIntervalShardingAlgorithmTest.java | 112 ---------------
.../DateCosIdIntervalShardingAlgorithmTest.java | 75 ----------
.../InstantCosIdIntervalShardingAlgorithmTest.java | 75 ----------
...ocalDateCosIdIntervalShardingAlgorithmTest.java | 76 ----------
...DateTimeCosIdIntervalShardingAlgorithmTest.java | 75 ----------
...DateTimeCosIdIntervalShardingAlgorithmTest.java | 75 ----------
...imestampCosIdIntervalShardingAlgorithmTest.java | 75 ----------
.../SqlDateCosIdIntervalShardingAlgorithmTest.java | 75 ----------
.../StringCosIdIntervalShardingAlgorithmTest.java | 74 ----------
...imestampCosIdIntervalShardingAlgorithmTest.java | 74 ----------
...earMonthCosIdIntervalShardingAlgorithmTest.java | 88 ------------
...DateTimeCosIdIntervalShardingAlgorithmTest.java | 75 ----------
.../IntervalShardingAlgorithmDataFixture.java | 140 ------------------
.../mod/CosIdModShardingAlgorithmTest.java | 157 ---------------------
17 files changed, 1409 deletions(-)
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/Arguments.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/Arguments.java
deleted file mode 100644
index e3e36017155..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/Arguments.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-
-import java.util.Arrays;
-
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class Arguments {
-
- /**
- * Of arguments.
- *
- * @param args arguments
- * @param <T> type of arguments
- * @return arguments
- */
- @SafeVarargs
- public static <T> T[] of(final T... args) {
- return args;
- }
-
- /**
- * Of array element.
- *
- * @param args arguments
- * @param <T> type of arguments
- * @return iterable
- */
- @SafeVarargs
- public static <T> Iterable<T[]> ofArrayElement(final T[]... args) {
- return Arrays.asList(args);
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/AbstractPreciseShardingValueParameterizedTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/AbstractPreciseShardingValueParameterizedTest.java
deleted file mode 100644
index 220eadc270a..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/AbstractPreciseShardingValueParameterizedTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
-import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
-import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import org.junit.Before;
-
-@RequiredArgsConstructor
-public abstract class AbstractPreciseShardingValueParameterizedTest<T extends Comparable<?>> {
-
- private final T input;
-
- private final String expected;
-
- private CosIdIntervalShardingAlgorithm algorithm;
-
- @Before
- public void setup() {
- algorithm = IntervalShardingAlgorithmDataFixture.createShardingAlgorithm();
- }
-
- /**
- * Do sharding test.
- */
- protected void doSharding() {
- PreciseShardingValue<Comparable<?>> shardingValue = new PreciseShardingValue<>(IntervalShardingAlgorithmDataFixture.LOGIC_NAME, IntervalShardingAlgorithmDataFixture.COLUMN_NAME,
- new DataNodeInfo(IntervalShardingAlgorithmDataFixture.LOGIC_NAME_PREFIX, 6, '0'),
- input);
- String actual = algorithm.doSharding(IntervalShardingAlgorithmDataFixture.ALL_NODES, shardingValue);
- assertThat(actual, is(expected));
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/AbstractRangeShardingValueParameterizedTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/AbstractRangeShardingValueParameterizedTest.java
deleted file mode 100644
index 8ec53b52116..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/AbstractRangeShardingValueParameterizedTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-import java.util.Collection;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
-import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
-import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import org.junit.Before;
-
-@RequiredArgsConstructor
-public abstract class AbstractRangeShardingValueParameterizedTest<T extends Comparable<?>> {
-
- private final Range<T> input;
-
- private final Collection<String> expected;
-
- private CosIdIntervalShardingAlgorithm algorithm;
-
- @Before
- public void init() {
- algorithm = IntervalShardingAlgorithmDataFixture.createShardingAlgorithm();
- }
-
- /**
- * Do sharding test.
- */
- @SuppressWarnings({"rawtypes", "unchecked"})
- protected void doSharding() {
- RangeShardingValue shardingValue = new RangeShardingValue<>(
- IntervalShardingAlgorithmDataFixture.LOGIC_NAME,
- IntervalShardingAlgorithmDataFixture.COLUMN_NAME,
- new DataNodeInfo(IntervalShardingAlgorithmDataFixture.LOGIC_NAME_PREFIX, 6, '0'),
- input);
- Collection<String> actual = algorithm.doSharding(IntervalShardingAlgorithmDataFixture.ALL_NODES, shardingValue);
- assertThat(actual, is(expected));
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/CosIdSnowflakeIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/CosIdSnowflakeIntervalShardingAlgorithmTest.java
deleted file mode 100644
index f4945bb0f02..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/CosIdSnowflakeIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-import lombok.RequiredArgsConstructor;
-import me.ahoo.cosid.snowflake.MillisecondSnowflakeId;
-import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
-import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
-import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
-import org.apache.shardingsphere.sharding.cosid.algorithm.CosIdAlgorithmConstants;
-import org.apache.shardingsphere.sharding.cosid.algorithm.keygen.CosIdSnowflakeKeyGenerateAlgorithm;
-import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture.IntervalShardingAlgorithmDataFixture;
-import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
-import org.apache.shardingsphere.test.util.PropertiesBuilder;
-import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
-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;
-import java.util.Properties;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public final class CosIdSnowflakeIntervalShardingAlgorithmTest {
-
- private static long convertToSnowflakeId(final LocalDateTime dateTime) {
- long epochMilliseconds = dateTime.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli();
- long timeDiff = epochMilliseconds - CosIdSnowflakeKeyGenerateAlgorithm.DEFAULT_EPOCH;
- return timeDiff << (MillisecondSnowflakeId.DEFAULT_SEQUENCE_BIT + MillisecondSnowflakeId.DEFAULT_MACHINE_BIT);
- }
-
- private static Properties createProperties() {
- return PropertiesBuilder.build(
- new Property("zone-id", "Asia/Shanghai"),
- new Property(CosIdAlgorithmConstants.LOGIC_NAME_PREFIX_KEY, IntervalShardingAlgorithmDataFixture.LOGIC_NAME_PREFIX),
- new Property(CosIdIntervalShardingAlgorithm.DATE_TIME_LOWER_KEY,
- IntervalShardingAlgorithmDataFixture.LOWER_DATE_TIME.format(CosIdIntervalShardingAlgorithm.DEFAULT_DATE_TIME_FORMATTER)),
- new Property(CosIdIntervalShardingAlgorithm.DATE_TIME_UPPER_KEY,
- IntervalShardingAlgorithmDataFixture.UPPER_DATE_TIME.format(CosIdIntervalShardingAlgorithm.DEFAULT_DATE_TIME_FORMATTER)),
- new Property(CosIdIntervalShardingAlgorithm.SHARDING_SUFFIX_FORMAT_KEY, IntervalShardingAlgorithmDataFixture.SUFFIX_FORMATTER_STRING),
- new Property(CosIdIntervalShardingAlgorithm.INTERVAL_UNIT_KEY, "MONTHS"),
- new Property(CosIdIntervalShardingAlgorithm.INTERVAL_AMOUNT_KEY, "1"));
- }
-
- @RunWith(Parameterized.class)
- @RequiredArgsConstructor
- public static class SnowflakeIdPreciseValueDoShardingTest {
-
- private final Long snowflakeId;
-
- private final String expected;
-
- @Parameters
- public static Iterable<Object[]> argsProvider() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(CosIdSnowflakeIntervalShardingAlgorithmTest::convertToSnowflakeId);
- }
-
- @Test
- public void assertDoSharding() {
- CosIdSnowflakeIntervalShardingAlgorithm algorithm = (CosIdSnowflakeIntervalShardingAlgorithm) TypedSPILoader.getService(
- ShardingAlgorithm.class, "COSID_INTERVAL_SNOWFLAKE", createProperties());
- PreciseShardingValue shardingValue = new PreciseShardingValue<>(IntervalShardingAlgorithmDataFixture.LOGIC_NAME,
- IntervalShardingAlgorithmDataFixture.COLUMN_NAME, new DataNodeInfo(IntervalShardingAlgorithmDataFixture.LOGIC_NAME_PREFIX, 6, '0'), snowflakeId);
- String actual = algorithm.doSharding(IntervalShardingAlgorithmDataFixture.ALL_NODES, shardingValue);
- assertThat(actual, is(expected));
- }
- }
-
- @RunWith(Parameterized.class)
- @RequiredArgsConstructor
- public static class SnowflakeIdRangeValueDoShardingTest {
-
- private final Range<Long> rangeValue;
-
- private final Collection<String> expected;
-
- @Parameters
- public static Iterable<Object[]> argsProvider() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(CosIdSnowflakeIntervalShardingAlgorithmTest::convertToSnowflakeId);
- }
-
- @Test
- public void assertDoSharding() {
- CosIdSnowflakeIntervalShardingAlgorithm algorithm = (CosIdSnowflakeIntervalShardingAlgorithm) TypedSPILoader.getService(
- ShardingAlgorithm.class, "COSID_INTERVAL_SNOWFLAKE", createProperties());
- RangeShardingValue shardingValue = new RangeShardingValue<>(IntervalShardingAlgorithmDataFixture.LOGIC_NAME,
- IntervalShardingAlgorithmDataFixture.COLUMN_NAME, new DataNodeInfo(IntervalShardingAlgorithmDataFixture.LOGIC_NAME_PREFIX, 6, '0'), rangeValue);
- assertThat(algorithm.doSharding(IntervalShardingAlgorithmDataFixture.ALL_NODES, shardingValue), is(expected));
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/DateCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/DateCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index 45ca4b13f96..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/DateCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsDate() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> new Date(ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli()));
- }
-
- static Iterable<Object[]> rangeArgsProviderAsDate() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> new Date(ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli()));
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<Date> {
-
- public PreciseShardingValueDoShardingTest(final Date input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsDate();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<Date> {
-
- public RangeShardingValueDoShardingTest(final Range<Date> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsDate();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/InstantCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/InstantCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index 3d6241c2894..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/InstantCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsInstant() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI));
- }
-
- static Iterable<Object[]> rangeArgsProviderAsInstant() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI));
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<Instant> {
-
- public PreciseShardingValueDoShardingTest(final Instant input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsInstant();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<Instant> {
-
- public RangeShardingValueDoShardingTest(final Range<Instant> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsInstant();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index a8d24cbe657..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsLocalDate() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(LocalDateTime::toLocalDate);
- }
-
- static Iterable<Object[]> rangeArgsProviderAsLocalDate() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(LocalDateTime::toLocalDate);
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<LocalDate> {
-
- public PreciseShardingValueDoShardingTest(final LocalDate input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsLocalDate();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<LocalDate> {
-
- public RangeShardingValueDoShardingTest(final Range<LocalDate> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsLocalDate();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateTimeCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateTimeCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index 105cfd91c47..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/LocalDateTimeCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsLocalDateTime() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> ldt);
- }
-
- static Iterable<Object[]> rangeArgsProviderAsLocalDateTime() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> ldt);
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<LocalDateTime> {
-
- public PreciseShardingValueDoShardingTest(final LocalDateTime input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsLocalDateTime();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<LocalDateTime> {
-
- public RangeShardingValueDoShardingTest(final Range<LocalDateTime> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsLocalDateTime();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/OffsetDateTimeCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/OffsetDateTimeCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index 1ece32ac8b8..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/OffsetDateTimeCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsOffsetDateTime() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> OffsetDateTime.of(ldt, IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI));
- }
-
- static Iterable<Object[]> rangeArgsProviderAsOffsetDateTime() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> OffsetDateTime.of(ldt, IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI));
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<OffsetDateTime> {
-
- public PreciseShardingValueDoShardingTest(final OffsetDateTime input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsOffsetDateTime();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<OffsetDateTime> {
-
- public RangeShardingValueDoShardingTest(final Range<OffsetDateTime> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsOffsetDateTime();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SQLTimestampCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SQLTimestampCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index 7884f8b69b6..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SQLTimestampCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsTimestamp() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> new Timestamp(ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli()));
- }
-
- static Iterable<Object[]> rangeArgsProviderAsTimestamp() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> new Timestamp(ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli()));
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<Timestamp> {
-
- public PreciseShardingValueDoShardingTest(final Timestamp input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsTimestamp();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<Timestamp> {
-
- public RangeShardingValueDoShardingTest(final Range<Timestamp> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsTimestamp();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlDateCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlDateCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index 1b87311bfb7..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/SqlDateCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsDate() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> new Date(ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli()));
- }
-
- static Iterable<Object[]> rangeArgsProviderAsDate() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> new Date(ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli()));
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<Date> {
-
- public PreciseShardingValueDoShardingTest(final Date input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsDate();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<Date> {
-
- public RangeShardingValueDoShardingTest(final Range<Date> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsDate();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/StringCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/StringCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index 77a3734dcc7..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/StringCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsString() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> ldt.format(CosIdIntervalShardingAlgorithm.DEFAULT_DATE_TIME_FORMATTER));
- }
-
- static Iterable<Object[]> rangeArgsProviderAsString() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> ldt.format(CosIdIntervalShardingAlgorithm.DEFAULT_DATE_TIME_FORMATTER));
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<String> {
-
- public PreciseShardingValueDoShardingTest(final String input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsString();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<String> {
-
- public RangeShardingValueDoShardingTest(final Range<String> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsString();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/TimestampCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/TimestampCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index a1033f301e6..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/TimestampCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsTimestamp() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli());
- }
-
- static Iterable<Object[]> rangeArgsProviderAsTimestamp() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> ldt.toInstant(IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI).toEpochMilli());
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<Long> {
-
- public PreciseShardingValueDoShardingTest(final Long input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsTimestamp();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<Long> {
-
- public RangeShardingValueDoShardingTest(final Range<Long> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsTimestamp();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/YearMonthCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/YearMonthCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index c189d04f130..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/YearMonthCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsYearMonth() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> YearMonth.of(ldt.getYear(), ldt.getMonth()));
- }
-
- static Iterable<Object[]> rangeArgsProviderAsYearMonth() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> YearMonth.of(ldt.getYear(), ldt.getMonth()));
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<YearMonth> {
-
- public PreciseShardingValueDoShardingTest(final YearMonth input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsYearMonth();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<YearMonth> {
-
- public RangeShardingValueDoShardingTest(final Range<YearMonth> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- List<Object[]> result = new LinkedList<>();
- Iterable<Object[]> iterable = rangeArgsProviderAsYearMonth();
- iterable.forEach(each -> {
- Range<YearMonth> shardingValue = (Range<YearMonth>) each[0];
- ExactCollection<String> expect = (ExactCollection<String>) each[1];
- if (shardingValue.equals(Range.lessThan(YearMonth.of(2021, 5)))) {
- expect = new ExactCollection<>("table_202101", "table_202102", "table_202103", "table_202104");
- }
- result.add(new Object[]{shardingValue, expect});
- });
- return result;
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/ZonedDateTimeCosIdIntervalShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/ZonedDateTimeCosIdIntervalShardingAlgorithmTest.java
deleted file mode 100644
index a63139aa766..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/ZonedDateTimeCosIdIntervalShardingAlgorithmTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval;
-
-import com.google.common.collect.Range;
-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 {
-
- static Iterable<Object[]> preciseArgsProviderAsZonedDateTime() {
- return IntervalShardingAlgorithmDataFixture.preciseArgsProvider(ldt -> ZonedDateTime.of(ldt, IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI));
- }
-
- static Iterable<Object[]> rangeArgsProviderAsZonedDateTime() {
- return IntervalShardingAlgorithmDataFixture.rangeArgsProvider(ldt -> ZonedDateTime.of(ldt, IntervalShardingAlgorithmDataFixture.ZONE_OFFSET_SHANGHAI));
- }
-
- @RunWith(Parameterized.class)
- public static final class PreciseShardingValueDoShardingTest extends AbstractPreciseShardingValueParameterizedTest<ZonedDateTime> {
-
- public PreciseShardingValueDoShardingTest(final ZonedDateTime input, final String expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return preciseArgsProviderAsZonedDateTime();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-
- @RunWith(Parameterized.class)
- public static final class RangeShardingValueDoShardingTest extends AbstractRangeShardingValueParameterizedTest<ZonedDateTime> {
-
- public RangeShardingValueDoShardingTest(final Range<ZonedDateTime> input, final Collection<String> expected) {
- super(input, expected);
- }
-
- @Parameters(name = "{index}: doSharding({0})={1}")
- public static Iterable<Object[]> argsProvider() {
- return rangeArgsProviderAsZonedDateTime();
- }
-
- @Test
- public void assertDoSharding() {
- doSharding();
- }
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/fixture/IntervalShardingAlgorithmDataFixture.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/fixture/IntervalShardingAlgorithmDataFixture.java
deleted file mode 100644
index 5d507c8cfdb..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/interval/fixture/IntervalShardingAlgorithmDataFixture.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.fixture;
-
-import com.google.common.collect.Range;
-import lombok.AccessLevel;
-import lombok.RequiredArgsConstructor;
-import me.ahoo.cosid.sharding.ExactCollection;
-import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.sharding.cosid.algorithm.Arguments;
-import org.apache.shardingsphere.sharding.cosid.algorithm.CosIdAlgorithmConstants;
-import org.apache.shardingsphere.sharding.cosid.algorithm.sharding.interval.CosIdIntervalShardingAlgorithm;
-import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
-import org.apache.shardingsphere.test.util.PropertiesBuilder;
-import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
-
-import java.time.LocalDateTime;
-import java.time.ZoneOffset;
-import java.util.Properties;
-import java.util.function.Function;
-
-@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
-public final class IntervalShardingAlgorithmDataFixture {
-
- public static final ZoneOffset ZONE_OFFSET_SHANGHAI;
-
- public static final LocalDateTime LOWER_DATE_TIME;
-
- public static final LocalDateTime UPPER_DATE_TIME;
-
- public static final String LOGIC_NAME;
-
- public static final String LOGIC_NAME_PREFIX;
-
- public static final String COLUMN_NAME;
-
- public static final String SUFFIX_FORMATTER_STRING;
-
- public static final ExactCollection<String> ALL_NODES;
-
- static {
- ZONE_OFFSET_SHANGHAI = ZoneOffset.of("+8");
- LOWER_DATE_TIME = LocalDateTime.of(2021, 1, 1, 0, 0);
- UPPER_DATE_TIME = LOWER_DATE_TIME.plusYears(1);
- LOGIC_NAME = "table";
- LOGIC_NAME_PREFIX = LOGIC_NAME + "_";
- COLUMN_NAME = "create_time";
- SUFFIX_FORMATTER_STRING = "yyyyMM";
- ALL_NODES = new ExactCollection<>("table_202101", "table_202102", "table_202103", "table_202104",
- "table_202105", "table_202106", "table_202107", "table_202108", "table_202109",
- "table_202110", "table_202111", "table_202112", "table_202201");
- }
-
- /**
- * Precise parameter provider.
- *
- * @param datetimeConvert datetimeConvert
- * @return unit test parameter collection
- */
- public static Iterable<Object[]> preciseArgsProvider(final Function<LocalDateTime, ? extends Comparable<?>> datetimeConvert) {
- return Arguments.ofArrayElement(
- Arguments.of(datetimeConvert.apply(LOWER_DATE_TIME), "table_202101"),
- Arguments.of(datetimeConvert.apply(LocalDateTime.of(2021, 2, 14, 22, 0)), "table_202102"),
- Arguments.of(datetimeConvert.apply(LocalDateTime.of(2021, 10, 1, 0, 0)), "table_202110"),
- Arguments.of(datetimeConvert.apply(UPPER_DATE_TIME), "table_202201"));
- }
-
- /**
- * Range parameter provider.
- *
- * @param datetimeConvert datetimeConvert
- * @return unit test parameter collection
- */
- public static Iterable<Object[]> rangeArgsProvider(final Function<LocalDateTime, ? extends Comparable<?>> datetimeConvert) {
- return Arguments.ofArrayElement(
- Arguments.of(Range.all(), ALL_NODES),
- Arguments.of(Range.closed(datetimeConvert.apply(LOWER_DATE_TIME), datetimeConvert.apply(UPPER_DATE_TIME)), ALL_NODES),
- Arguments.of(Range.closed(datetimeConvert.apply(LocalDateTime.of(2021, 1, 1, 0, 0)),
- datetimeConvert.apply(LocalDateTime.of(2021, 2, 1, 0, 0))),
- new ExactCollection<>("table_202101", "table_202102")),
- Arguments.of(Range.closed(datetimeConvert.apply(LOWER_DATE_TIME.minusMonths(1)), datetimeConvert.apply(UPPER_DATE_TIME.plusMonths(1))), ALL_NODES),
- Arguments.of(Range.closed(datetimeConvert.apply(LocalDateTime.of(2021, 12, 1, 0, 0)),
- datetimeConvert.apply(LocalDateTime.of(2022, 2, 1, 0, 0))),
- new ExactCollection<>("table_202112", "table_202201")),
- Arguments.of(Range.closedOpen(datetimeConvert.apply(LOWER_DATE_TIME), datetimeConvert.apply(UPPER_DATE_TIME)),
- new ExactCollection<>("table_202101", "table_202102", "table_202103", "table_202104", "table_202105", "table_202106",
- "table_202107", "table_202108", "table_202109", "table_202110", "table_202111", "table_202112")),
- Arguments.of(Range.openClosed(datetimeConvert.apply(LOWER_DATE_TIME), datetimeConvert.apply(UPPER_DATE_TIME)), ALL_NODES),
- Arguments.of(Range.greaterThan(datetimeConvert.apply(LOWER_DATE_TIME)), ALL_NODES),
- Arguments.of(Range.atLeast(datetimeConvert.apply(LOWER_DATE_TIME)), ALL_NODES),
- Arguments.of(Range.greaterThan(datetimeConvert.apply(UPPER_DATE_TIME)), new ExactCollection<>("table_202201")),
- Arguments.of(Range.atLeast(datetimeConvert.apply(UPPER_DATE_TIME)), new ExactCollection<>("table_202201")),
- Arguments.of(Range.greaterThan(datetimeConvert.apply(LocalDateTime.of(2021, 12, 5, 0, 0))),
- new ExactCollection<>("table_202112", "table_202201")),
- Arguments.of(Range.atLeast(datetimeConvert.apply(LocalDateTime.of(2021, 12, 5, 0, 0))),
- new ExactCollection<>("table_202112", "table_202201")),
- Arguments.of(Range.lessThan(datetimeConvert.apply(LOWER_DATE_TIME)), ExactCollection.empty()),
- Arguments.of(Range.atMost(datetimeConvert.apply(LOWER_DATE_TIME)), new ExactCollection<>("table_202101")),
- Arguments.of(Range.lessThan(datetimeConvert.apply(UPPER_DATE_TIME)), new ExactCollection<>("table_202101",
- "table_202102", "table_202103", "table_202104", "table_202105", "table_202106", "table_202107",
- "table_202108", "table_202109", "table_202110", "table_202111", "table_202112")),
- Arguments.of(Range.atMost(datetimeConvert.apply(UPPER_DATE_TIME)), ALL_NODES),
- Arguments.of(Range.lessThan(datetimeConvert.apply(LocalDateTime.of(2021, 5, 5, 0, 0))),
- new ExactCollection<>("table_202101", "table_202102", "table_202103", "table_202104", "table_202105")),
- Arguments.of(Range.atMost(datetimeConvert.apply(LocalDateTime.of(2021, 5, 5, 0, 0))),
- new ExactCollection<>("table_202101", "table_202102", "table_202103", "table_202104", "table_202105")));
- }
-
- /**
- * Create CosId interval sharding algorithm.
- *
- * @return CosId interval sharding algorithm
- */
- public static CosIdIntervalShardingAlgorithm createShardingAlgorithm() {
- Properties props = PropertiesBuilder.build(
- new Property("zone-id", "Asia/Shanghai"),
- new Property(CosIdAlgorithmConstants.LOGIC_NAME_PREFIX_KEY, LOGIC_NAME_PREFIX),
- new Property(CosIdIntervalShardingAlgorithm.DATE_TIME_LOWER_KEY, LOWER_DATE_TIME.format(CosIdIntervalShardingAlgorithm.DEFAULT_DATE_TIME_FORMATTER)),
- new Property(CosIdIntervalShardingAlgorithm.DATE_TIME_UPPER_KEY, UPPER_DATE_TIME.format(CosIdIntervalShardingAlgorithm.DEFAULT_DATE_TIME_FORMATTER)),
- new Property(CosIdIntervalShardingAlgorithm.SHARDING_SUFFIX_FORMAT_KEY, SUFFIX_FORMATTER_STRING),
- new Property(CosIdIntervalShardingAlgorithm.INTERVAL_UNIT_KEY, "MONTHS"),
- new Property(CosIdIntervalShardingAlgorithm.INTERVAL_AMOUNT_KEY, "1"));
- return (CosIdIntervalShardingAlgorithm) TypedSPILoader.getService(ShardingAlgorithm.class, "COSID_INTERVAL", props);
- }
-}
diff --git a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/mod/CosIdModShardingAlgorithmTest.java b/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/mod/CosIdModShardingAlgorithmTest.java
deleted file mode 100644
index 27f66f6f34a..00000000000
--- a/features/sharding/plugin/cosid/src/test/java/org/apache/shardingsphere/sharding/cosid/algorithm/sharding/mod/CosIdModShardingAlgorithmTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.cosid.algorithm.sharding.mod;
-
-import com.google.common.collect.Range;
-import lombok.RequiredArgsConstructor;
-import me.ahoo.cosid.sharding.ExactCollection;
-import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
-import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
-import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
-import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
-import org.apache.shardingsphere.sharding.cosid.algorithm.Arguments;
-import org.apache.shardingsphere.sharding.cosid.algorithm.CosIdAlgorithmConstants;
-import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
-import org.apache.shardingsphere.test.util.PropertiesBuilder;
-import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
-import org.junit.Before;
-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.Properties;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-public final class CosIdModShardingAlgorithmTest {
-
- static final int DIVISOR = 4;
-
- static final String LOGIC_NAME = "t_mod";
-
- static final String COLUMN_NAME = "id";
-
- static final String LOGIC_NAME_PREFIX = LOGIC_NAME + "_";
-
- static final ExactCollection<String> ALL_NODES = new ExactCollection<>("t_mod_0", "t_mod_1", "t_mod_2", "t_mod_3");
-
- @SuppressWarnings("unchecked")
- static CosIdModShardingAlgorithm<Long> createShardingAlgorithm() {
- Properties props = PropertiesBuilder.build(new Property(CosIdAlgorithmConstants.LOGIC_NAME_PREFIX_KEY, LOGIC_NAME_PREFIX), new Property("mod", Integer.toString(DIVISOR)));
- return (CosIdModShardingAlgorithm<Long>) TypedSPILoader.getService(ShardingAlgorithm.class, "COSID_MOD", props);
- }
-
- @RunWith(Parameterized.class)
- @RequiredArgsConstructor
- public static class PreciseValueDoShardingTest {
-
- private final long id;
-
- private CosIdModShardingAlgorithm<Long> algorithm;
-
- @Before
- public void init() {
- algorithm = createShardingAlgorithm();
- }
-
- @Parameters
- public static Number[] argsProvider() {
- return Arguments.of(1L, 2L, 3L, 4L, 5L, 6L);
- }
-
- @Test
- public void assertDoSharding() {
- PreciseShardingValue<Long> shardingValue = new PreciseShardingValue<>(LOGIC_NAME, COLUMN_NAME, new DataNodeInfo(LOGIC_NAME_PREFIX, 1, '0'), id);
- String actual = algorithm.doSharding(ALL_NODES, shardingValue);
- String expected = LOGIC_NAME_PREFIX + (id % DIVISOR);
- assertThat(actual, is(expected));
- }
- }
-
- @RunWith(Parameterized.class)
- @RequiredArgsConstructor
- public static class RangeValueDoShardingTest {
-
- private final Range<Long> rangeValue;
-
- private final Collection<String> expected;
-
- private CosIdModShardingAlgorithm<Long> algorithm;
-
- @Before
- public void init() {
- algorithm = createShardingAlgorithm();
- }
-
- @Parameters
- public static Iterable<Object[]> argsProvider() {
- return Arguments.ofArrayElement(Arguments.of(Range.all(), ALL_NODES),
- Arguments.of(Range.closed(1L, 3L), new ExactCollection<>("t_mod_1", "t_mod_2", "t_mod_3")),
- Arguments.of(Range.closed(0L, 3L), ALL_NODES), Arguments.of(Range.closed(0L, 4L), ALL_NODES),
- Arguments.of(Range.closed(0L, 1L), new ExactCollection<>("t_mod_0", "t_mod_1")),
- Arguments.of(Range.closed(3L, 4L), new ExactCollection<>("t_mod_0", "t_mod_3")),
- Arguments.of(Range.closedOpen(1L, 3L), new ExactCollection<>("t_mod_1", "t_mod_2")),
- Arguments.of(Range.closedOpen(0L, 3L), new ExactCollection<>("t_mod_0", "t_mod_1", "t_mod_2")),
- Arguments.of(Range.closedOpen(0L, 4L), ALL_NODES),
- Arguments.of(Range.closedOpen(0L, 1L), new ExactCollection<>("t_mod_0")),
- Arguments.of(Range.closedOpen(3L, 4L), new ExactCollection<>("t_mod_3")),
- Arguments.of(Range.openClosed(1L, 3L), new ExactCollection<>("t_mod_2", "t_mod_3")),
- Arguments.of(Range.openClosed(0L, 3L), new ExactCollection<>("t_mod_1", "t_mod_2", "t_mod_3")),
- Arguments.of(Range.openClosed(0L, 4L), ALL_NODES),
- Arguments.of(Range.openClosed(0L, 1L), new ExactCollection<>("t_mod_1")),
- Arguments.of(Range.openClosed(3L, 4L), new ExactCollection<>("t_mod_0")),
- Arguments.of(Range.open(1L, 3L), new ExactCollection<>("t_mod_2")),
- Arguments.of(Range.open(0L, 3L), new ExactCollection<>("t_mod_1", "t_mod_2")),
- Arguments.of(Range.open(0L, 4L), new ExactCollection<>("t_mod_1", "t_mod_2", "t_mod_3")),
- Arguments.of(Range.open(0L, 1L), ExactCollection.empty()),
- Arguments.of(Range.open(3L, 4L), ExactCollection.empty()),
- Arguments.of(Range.greaterThan(0L), ALL_NODES),
- Arguments.of(Range.greaterThan(1L), ALL_NODES),
- Arguments.of(Range.greaterThan(2L), ALL_NODES),
- Arguments.of(Range.greaterThan(3L), ALL_NODES),
- Arguments.of(Range.greaterThan(4L), ALL_NODES),
- Arguments.of(Range.greaterThan(5L), ALL_NODES),
- Arguments.of(Range.atLeast(0L), ALL_NODES),
- Arguments.of(Range.atLeast(1L), ALL_NODES),
- Arguments.of(Range.atLeast(2L), ALL_NODES),
- Arguments.of(Range.atLeast(3L), ALL_NODES),
- Arguments.of(Range.atLeast(4L), ALL_NODES),
- Arguments.of(Range.atLeast(5L), ALL_NODES),
- Arguments.of(Range.lessThan(0L), ExactCollection.empty()),
- Arguments.of(Range.lessThan(1L), new ExactCollection<>("t_mod_0")),
- Arguments.of(Range.lessThan(2L), new ExactCollection<>("t_mod_0", "t_mod_1")),
- Arguments.of(Range.lessThan(3L), new ExactCollection<>("t_mod_0", "t_mod_1", "t_mod_2")),
- Arguments.of(Range.lessThan(4L), ALL_NODES), Arguments.of(Range.lessThan(5L), ALL_NODES),
- Arguments.of(Range.atMost(0L), new ExactCollection<>("t_mod_0")),
- Arguments.of(Range.atMost(1L), new ExactCollection<>("t_mod_0", "t_mod_1")),
- Arguments.of(Range.atMost(2L), new ExactCollection<>("t_mod_0", "t_mod_1", "t_mod_2")),
- Arguments.of(Range.atMost(3L), ALL_NODES), Arguments.of(Range.atMost(4L), ALL_NODES),
- Arguments.of(Range.atMost(5L), ALL_NODES));
- }
-
- @Test
- public void assertDoSharding() {
- RangeShardingValue<Long> shardingValue = new RangeShardingValue<>(LOGIC_NAME, COLUMN_NAME, new DataNodeInfo(LOGIC_NAME_PREFIX, 1, '0'), rangeValue);
- Collection<String> actual = algorithm.doSharding(ALL_NODES, shardingValue);
- assertThat(actual, is(expected));
- }
- }
-}