This is an automated email from the ASF dual-hosted git repository. rpuch pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push: new a929c0e085f IGNITE-24745 Support per-zone partitions in sql unit tests (#5386) a929c0e085f is described below commit a929c0e085fab5c815703fcd287fc22bd0251a7a Author: Roman Puchkovskiy <roman.puchkovs...@gmail.com> AuthorDate: Tue Mar 11 12:22:43 2025 +0400 IGNITE-24745 Support per-zone partitions in sql unit tests (#5386) This reverts 64d2e89ebb5c34edc06a5c073e4b8c548643f86c and adds an assumption to MappingServiceImplTest --- .../exec/ExecutableTableRegistrySelfTest.java | 11 +- .../exec/mapping/MappingServiceImplTest.java | 5 + .../sql/engine/framework/ClusterZoneBuilder.java | 43 ----- .../engine/framework/ClusterZoneBuilderImpl.java | 82 --------- .../sql/engine/framework/TestBuilders.java | 198 ++------------------- .../sql/engine/framework/ZoneBuilderBase.java | 50 ------ 6 files changed, 19 insertions(+), 370 deletions(-) diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/ExecutableTableRegistrySelfTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/ExecutableTableRegistrySelfTest.java index a7b8f71ec51..4ecd76ff1b5 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/ExecutableTableRegistrySelfTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/ExecutableTableRegistrySelfTest.java @@ -61,6 +61,7 @@ import org.mockito.junit.jupiter.MockitoExtension; */ @ExtendWith(MockitoExtension.class) public class ExecutableTableRegistrySelfTest extends BaseIgniteAbstractTest { + @Mock private ReplicaService replicaService; @@ -157,15 +158,7 @@ public class ExecutableTableRegistrySelfTest extends BaseIgniteAbstractTest { when(descriptor.spliterator()).thenReturn(Spliterators.emptySpliterator()); IgniteTable sqlTable = new IgniteTableImpl( - "TBL1", - tableId, - tableVersion, - descriptor, - ImmutableIntList.of(0), - new TestStatistic(1_000.0), - Map.of(), - 1, - 10000 + "TBL1", tableId, tableVersion, descriptor, ImmutableIntList.of(0), new TestStatistic(1_000.0), Map.of(), 1, 10000 ); when(sqlSchemaManager.table(schemaVersion, tableId)).thenReturn(sqlTable); diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImplTest.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImplTest.java index b5c2e88a176..ee3790aa53c 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImplTest.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/mapping/MappingServiceImplTest.java @@ -26,6 +26,7 @@ import static org.hamcrest.Matchers.not; import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeFalse; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anySet; @@ -49,6 +50,7 @@ import org.apache.ignite.internal.catalog.descriptors.CatalogObjectDescriptor; import org.apache.ignite.internal.hlc.ClockService; import org.apache.ignite.internal.hlc.HybridTimestamp; import org.apache.ignite.internal.hlc.TestClockService; +import org.apache.ignite.internal.lang.IgniteSystemProperties; import org.apache.ignite.internal.partitiondistribution.Assignment; import org.apache.ignite.internal.partitiondistribution.TokenizedAssignments; import org.apache.ignite.internal.partitiondistribution.TokenizedAssignmentsImpl; @@ -234,6 +236,9 @@ public class MappingServiceImplTest extends BaseIgniteAbstractTest { @Test public void testCacheInvalidationOnPrimaryExpiration() { + // TODO: https://issues.apache.org/jira/browse/IGNITE-24679 - remove this assumption. + assumeFalse(IgniteSystemProperties.enabledColocation()); + String localNodeName = "NODE"; List<String> nodeNames = List.of(localNodeName, "NODE1"); diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ClusterZoneBuilder.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ClusterZoneBuilder.java deleted file mode 100644 index 59665c5db64..00000000000 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ClusterZoneBuilder.java +++ /dev/null @@ -1,43 +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.ignite.internal.sql.engine.framework; - -import org.apache.ignite.internal.catalog.CatalogCommand; -import org.apache.ignite.internal.sql.engine.framework.TestBuilders.ClusterBuilder; -import org.apache.ignite.internal.sql.engine.framework.TestBuilders.NestedBuilder; - -/** - * A builder interface for creating a test zone as a nested object within a test cluster. - * - * <p> - * This builder allows the configuration and construction of test zones, which are integral parts of the {@link TestCluster}. - * Test zones can be customized and linked to the enclosing cluster through this builder. - * </p> - * - * <p> - * The {@link ClusterZoneBuilder} extends {@link ZoneBuilderBase}, inheriting common methods for zone configuration, - * and implements {@link NestedBuilder} to ensure fluent integration into the cluster creation process. - * </p> - * - * @see TestCluster - * @see ZoneBuilderBase - * @see NestedBuilder - */ -public interface ClusterZoneBuilder extends ZoneBuilderBase<ClusterZoneBuilder>, NestedBuilder<ClusterBuilder> { - CatalogCommand build(); -} diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ClusterZoneBuilderImpl.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ClusterZoneBuilderImpl.java deleted file mode 100644 index f1b6a52087e..00000000000 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ClusterZoneBuilderImpl.java +++ /dev/null @@ -1,82 +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.ignite.internal.sql.engine.framework; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import org.apache.ignite.internal.catalog.CatalogCommand; -import org.apache.ignite.internal.catalog.commands.CreateZoneCommand; -import org.apache.ignite.internal.catalog.commands.StorageProfileParams; -import org.apache.ignite.internal.sql.engine.framework.TestBuilders.ClusterBuilder; -import org.apache.ignite.internal.sql.engine.framework.TestBuilders.ClusterBuilderImpl; - -/** - * An implementation of the {@link ClusterZoneBuilder} interface. - * - * <p> - * This class provides the concrete functionality for building and configuring a test zone nested within a cluster. - * It enables the creation of zones through a fluent API, adhering to the contract defined by {@link ClusterZoneBuilder}. - * </p> - * - * @see ClusterZoneBuilder - */ -class ClusterZoneBuilderImpl implements ClusterZoneBuilder { - private final ClusterBuilderImpl parent; - - private String name; - - private List<String> storageProfiles; - - ClusterZoneBuilderImpl(ClusterBuilderImpl parent) { - this.parent = parent; - } - - @Override - public ClusterBuilder end() { - parent.zoneBuilders().add(this); - - return parent; - } - - @Override - public ClusterZoneBuilder name(String name) { - this.name = name; - - return this; - } - - @Override - public ClusterZoneBuilder storageProfiles(List<String> storageProfiles) { - this.storageProfiles = new ArrayList<>(storageProfiles); - - return this; - } - - @Override - public CatalogCommand build() { - List<StorageProfileParams> storageProfileParams = storageProfiles.stream() - .map(profileName -> StorageProfileParams.builder().storageProfile(profileName).build()) - .collect(Collectors.toList()); - - return CreateZoneCommand.builder() - .zoneName(name) - .storageProfilesParams(storageProfileParams) - .build(); - } -} diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/TestBuilders.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/TestBuilders.java index 8212d51409a..f872d0eed2b 100644 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/TestBuilders.java +++ b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/TestBuilders.java @@ -19,7 +19,6 @@ package org.apache.ignite.internal.sql.engine.framework; import static java.util.UUID.randomUUID; import static org.apache.ignite.internal.lang.IgniteStringFormatter.format; -import static org.apache.ignite.internal.lang.IgniteSystemProperties.enabledColocation; import static org.apache.ignite.internal.sql.engine.exec.ExecutionServiceImplTest.PLANNING_THREAD_COUNT; import static org.apache.ignite.internal.testframework.IgniteTestUtils.await; import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully; @@ -160,6 +159,8 @@ import org.jetbrains.annotations.Nullable; * A collection of builders to create test objects. */ public class TestBuilders { + private static final int ZONE_ID = 10000; + private static final AtomicInteger TABLE_ID_GEN = new AtomicInteger(); private static final IgniteLogger LOG = Loggers.forClass(TestBuilders.class); @@ -374,19 +375,6 @@ public class TestBuilders { */ ClusterBuilder operationKillHandlers(OperationKillHandler... handlers); - /** - * Creates a new builder for defining and adding a zone to the cluster. - * - * <p> - * The zone builder provides a fluent API - * to configure various zone-related attributes before adding it to the cluster configuration. - * It allows for incremental setup of the zone's properties such as name, storage profiles, and other settings. - * </p> - * - * @return An instance of the {@link ClusterZoneBuilder}, enabling the construction of a new zone. - */ - ClusterZoneBuilder addZone(); - /** * Creates a table builder to add to the cluster. * @@ -419,29 +407,10 @@ public class TestBuilders { ClusterBuilder defaultDataProvider(DefaultDataProvider defaultDataProvider); /** - * Sets the default implementation of the {@link DefaultZoneAssignmentsProvider}. - * - * <p> - * This method allows specifying a {@link DefaultZoneAssignmentsProvider} instance to define - * how default zone assignments are handled within the cluster during tests. - * This configuration influences the assignment logic for zones, ensuring proper setup and behavior in testing scenarios. - * </p> - * - * @param defaultZoneAssignmentsProvider The {@link DefaultZoneAssignmentsProvider} instance to configure. - * This instance determines the management of default zone assignments. - * @return {@code this}, enabling method chaining for fluent configuration. - */ - ClusterBuilder defaultZoneAssignmentsProvider(DefaultZoneAssignmentsProvider defaultZoneAssignmentsProvider); - - /** - * Configures a default implementation of the {@link DefaultAssignmentsProvider}. - * - * <p>This method allows specifying a {@link DefaultAssignmentsProvider} instance - * to be used during the creation of a test cluster. - * The provided instance determines how default assignments are managed within the cluster during its setup and operation. + * Provides implementation of table with given name. * - * @param defaultAssignmentsProvider The {@link DefaultAssignmentsProvider} instance to be applied. - * @return {@code this}, to allow method chaining. + * @param defaultAssignmentsProvider Name of the table given instance represents. + * @return {@code this} for chaining. */ ClusterBuilder defaultAssignmentsProvider(DefaultAssignmentsProvider defaultAssignmentsProvider); @@ -483,9 +452,6 @@ public class TestBuilders { /** Sets id for the table. The caller must guarantee that provided id is unique. */ TableBuilder tableId(int id); - /** Sets zone id for the table. */ - TableBuilder zoneId(int id); - /** Sets the number of partitions fot this table. Default value is equal to {@link CatalogUtils#DEFAULT_PARTITION_COUNT}. */ TableBuilder partitions(int num); @@ -659,8 +625,7 @@ public class TestBuilders { } } - static class ClusterBuilderImpl implements ClusterBuilder { - private final List<ClusterZoneBuilder> zoneBuilders = new ArrayList<>(); + private static class ClusterBuilderImpl implements ClusterBuilder { private final List<ClusterTableBuilderImpl> tableBuilders = new ArrayList<>(); private List<String> nodeNames; private final List<SystemView<?>> systemViews = new ArrayList<>(); @@ -671,7 +636,6 @@ public class TestBuilders { private OperationKillHandler @Nullable [] killHandlers = null; private @Nullable DefaultDataProvider defaultDataProvider = null; - private @Nullable DefaultZoneAssignmentsProvider defaultZoneAssignmentsProvider = null; private @Nullable DefaultAssignmentsProvider defaultAssignmentsProvider = null; /** {@inheritDoc} */ @@ -701,11 +665,6 @@ public class TestBuilders { return this; } - @Override - public ClusterZoneBuilder addZone() { - return new ClusterZoneBuilderImpl(this); - } - /** {@inheritDoc} */ @Override public ClusterTableBuilder addTable() { @@ -732,13 +691,6 @@ public class TestBuilders { return this; } - @Override - public ClusterBuilder defaultZoneAssignmentsProvider(DefaultZoneAssignmentsProvider defaultZoneAssignmentsProvider) { - this.defaultZoneAssignmentsProvider = defaultZoneAssignmentsProvider; - - return this; - } - @Override public ClusterBuilder defaultAssignmentsProvider(DefaultAssignmentsProvider defaultAssignmentsProvider) { this.defaultAssignmentsProvider = defaultAssignmentsProvider; @@ -817,15 +769,6 @@ public class TestBuilders { ConcurrentMap<String, ScannableTable> dataProvidersByTableName = new ConcurrentHashMap<>(); ConcurrentMap<String, UpdatableTable> updatableTablesByName = new ConcurrentHashMap<>(); - - ConcurrentMap<Integer, AssignmentsProvider> zoneAssignmentsProviderByZoneId = new ConcurrentHashMap<>(); - zoneAssignmentsProviderByZoneId.put( - Blackhole.ZONE_ID, - (partCount, ignored) -> IntStream.range(0, partCount) - .mapToObj(partNo -> nodeNames) - .collect(Collectors.toList()) - ); - ConcurrentMap<String, AssignmentsProvider> assignmentsProviderByTableName = new ConcurrentHashMap<>(); assignmentsProviderByTableName.put( @@ -841,11 +784,6 @@ public class TestBuilders { var systemViewManager = new SystemViewManagerImpl(name, catalogManager); var executionProvider = new TestExecutionDistributionProvider( systemViewManager::owningNodes, - zoneId -> resolveZoneProvider( - zoneId, - zoneAssignmentsProviderByZoneId, - defaultZoneAssignmentsProvider != null ? defaultZoneAssignmentsProvider::get : null - ), tableName -> resolveProvider( tableName, assignmentsProviderByTableName, @@ -908,10 +846,6 @@ public class TestBuilders { } private void initAction(CatalogManager catalogManager) { - List<CatalogCommand> initialZones = zoneBuilders.stream() - .map(ClusterZoneBuilder::build) - .collect(Collectors.toList()); - List<CatalogCommand> initialSchema = tableBuilders.stream() .flatMap(builder -> builder.build().stream()) .collect(Collectors.toList()); @@ -942,24 +876,9 @@ public class TestBuilders { }; catalogManager.listen(CatalogEvent.INDEX_CREATE, EventListener.fromConsumer(createIndexHandler)); - // Init zones - await(catalogManager.execute(initialZones)); - // Init schema. await(catalogManager.execute(initialSchema)); } - - /** - * Retrieves a list of {@link ClusterZoneBuilder} instances already defined for the test cluster. - * - * <p>This method provides access to the builders for zones that have been previously added during the test cluster setup. - * Each {@link ClusterZoneBuilder} instance represents the configuration for a specific zone within the test cluster. - * - * @return A list of {@link ClusterZoneBuilder} instances representing the predefined zones for the test cluster. - */ - List<ClusterZoneBuilder> zoneBuilders() { - return zoneBuilders; - } } private static SqlSchemaManagerImpl createSqlSchemaManager(CatalogManager catalogManager, ConcurrentMap<String, Long> tablesSize) { @@ -978,8 +897,6 @@ public class TestBuilders { } private static class TableBuilderImpl implements TableBuilder { - private int zoneId = Blackhole.ZONE_ID; - private final List<AbstractTableIndexBuilderImpl<?>> indexBuilders = new ArrayList<>(); private final List<ColumnDescriptor> columns = new ArrayList<>(); @@ -1074,13 +991,6 @@ public class TestBuilders { return this; } - @Override - public TableBuilder zoneId(int id) { - this.zoneId = id; - - return this; - } - /** {@inheritDoc} */ @Override public TableBuilder partitions(int num) { @@ -1131,7 +1041,7 @@ public class TestBuilders { new TestStatistic(size), indexes, partitions, - zoneId + ZONE_ID ); } } @@ -1556,7 +1466,7 @@ public class TestBuilders { * </pre> */ @FunctionalInterface - interface NestedBuilder<ParentT> { + private interface NestedBuilder<ParentT> { /** * Notifies the builder's chain of the nested builder that we need to return back to the previous layer. * @@ -1702,8 +1612,6 @@ public class TestBuilders { /** A builder to create instances of {@link ExecutionDistributionProvider}. */ public static final class ExecutionDistributionProviderBuilder { - private final Map<Integer, List<List<String>>> owningNodesByZone = new HashMap<>(); - private final Map<String, List<List<String>>> owningNodesByTableName = new HashMap<>(); private Function<String, List<String>> owningNodesBySystemViewName = (n) -> null; @@ -1714,19 +1622,6 @@ public class TestBuilders { } - /** - * Adds table-to-node mappings to the internal list. - * - * <p> - * This method updates the internal mapping by associating tables with specific nodes. - * It allows for defining or extending the relationships between tables and the nodes they are mapped to within the cluster. - * </p> - */ - public ExecutionDistributionProviderBuilder addZones(Map<Integer, List<List<String>>> zones) { - this.owningNodesByZone.putAll(zones); - return this; - } - /** Adds tables to list of nodes mapping. */ public ExecutionDistributionProviderBuilder addTables(Map<String, List<List<String>>> tables) { this.owningNodesByTableName.putAll(tables); @@ -1750,21 +1645,8 @@ public class TestBuilders { /** Creates an instance of {@link ExecutionDistributionProvider}. */ public ExecutionDistributionProvider build() { - Map<Integer, List<List<String>>> owningNodesByZone = Map.copyOf(this.owningNodesByZone); - Map<String, List<List<String>>> owningNodesByTableName = Map.copyOf(this.owningNodesByTableName); - Function<Integer, AssignmentsProvider> zoneSourceProviderFunction = zoneId -> - (AssignmentsProvider) (partitionsCount, includeBackups) -> { - List<List<String>> assignments = owningNodesByZone.get(zoneId); - - if (nullOrEmpty(assignments)) { - throw new AssertionError("Assignments are not configured for zone " + zoneId); - } - - return assignments; - }; - Function<String, AssignmentsProvider> sourceProviderFunction = tableName -> (AssignmentsProvider) (partitionsCount, includeBackups) -> { List<List<String>> assignments = owningNodesByTableName.get(tableName); @@ -1778,7 +1660,6 @@ public class TestBuilders { return new TestExecutionDistributionProvider( owningNodesBySystemViewName, - zoneSourceProviderFunction, sourceProviderFunction, useTablePartitions ); @@ -1788,20 +1669,16 @@ public class TestBuilders { private static class TestExecutionDistributionProvider implements ExecutionDistributionProvider { final Function<String, List<String>> owningNodesBySystemViewName; - final Function<Integer, AssignmentsProvider> owningNodesByZone; - final Function<String, AssignmentsProvider> owningNodesByTableName; final boolean useTablePartitions; private TestExecutionDistributionProvider( Function<String, List<String>> owningNodesBySystemViewName, - Function<Integer, AssignmentsProvider> owningNodesByZone, Function<String, AssignmentsProvider> owningNodesByTableName, boolean useTablePartitions ) { this.owningNodesBySystemViewName = owningNodesBySystemViewName; - this.owningNodesByZone = owningNodesByZone; this.owningNodesByTableName = owningNodesByTableName; this.useTablePartitions = useTablePartitions; } @@ -1819,35 +1696,18 @@ public class TestBuilders { IgniteTable table, boolean includeBackups ) { - AssignmentsProvider provider; - - if (enabledColocation()) { - provider = owningNodesByZone.apply(table.zoneId()); - } else { - provider = owningNodesByTableName.apply(table.name()); - } - - return getAssignments(provider, table, includeBackups); - } + AssignmentsProvider provider = owningNodesByTableName.apply(table.name()); - private CompletableFuture<List<TokenizedAssignments>> getAssignments( - AssignmentsProvider provider, - IgniteTable table, - boolean includeBackups - ) { if (provider == null) { return CompletableFuture.failedFuture( new AssertionError("AssignmentsProvider is not configured for table " + table.name()) ); } + List<List<String>> owningNodes = provider.get(table.partitions(), includeBackups); - int partitions = table.partitions(); - - List<List<String>> owningNodes = provider.get(partitions, includeBackups); - - if (nullOrEmpty(owningNodes) || owningNodes.size() != partitions) { + if (nullOrEmpty(owningNodes) || owningNodes.size() != table.partitions()) { throw new AssertionError("Configured AssignmentsProvider returns less assignment than expected " - + "[table=" + table.name() + ", expectedNumberOfPartitions=" + partitions + + "[table=" + table.name() + ", expectedNumberOfPartitions=" + table.partitions() + ", returnedAssignmentSize=" + (owningNodes == null ? "<null>" : owningNodes.size()) + "]"); } @@ -1927,24 +1787,6 @@ public class TestBuilders { ScannableTable get(String tableName); } - /** - * The default zone assignments provider used as a fallback when no specific provider - * is explicitly configured via {@link TestCluster#setAssignmentsProvider(String, AssignmentsProvider)}. - * - * <p> - * This provider supplies default zone assignments necessary for executing SQL queries - * or simulating cluster behavior in tests where explicit zone assignment configurations are not required. - * </p> - * - * <p> - * Typically used in scenarios where test simplicity is preferred, and explicit zone assignment handling is unnecessary or redundant. - * </p> - */ - @FunctionalInterface - public interface DefaultZoneAssignmentsProvider { - AssignmentsProvider get(int zoneId); - } - /** * Assignments provider that will be used in case no other provider was specified explicitly via * {@link TestCluster#setAssignmentsProvider(String, AssignmentsProvider)}. @@ -1970,20 +1812,6 @@ public class TestBuilders { List<List<String>> get(int partitionsCount, boolean includeBackups); } - private static <T> @Nullable T resolveZoneProvider( - int zoneId, - Map<Integer, T> providersByZoneId, - @Nullable Function<Integer, T> defaultProvider - ) { - T provider = providersByZoneId.get(zoneId); - - if (provider == null && defaultProvider != null) { - return defaultProvider.apply(zoneId); - } - - return provider; - } - private static <T> @Nullable T resolveProvider( String tableName, Map<String, T> providersByTableName, @@ -1999,8 +1827,6 @@ public class TestBuilders { } private static class Blackhole implements UpdatableTable { - static final int ZONE_ID = 10_000; - static final String TABLE_NAME = "BLACKHOLE"; private static final TableDescriptor DESCRIPTOR = new TableDescriptorImpl( diff --git a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ZoneBuilderBase.java b/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ZoneBuilderBase.java deleted file mode 100644 index 87d706a5e22..00000000000 --- a/modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/ZoneBuilderBase.java +++ /dev/null @@ -1,50 +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.ignite.internal.sql.engine.framework; - -import java.util.List; - -/** - * Represents the base interface for describing a complete set of zone-related fields. - * - * <p> - * This interface serves as a foundational aspect to ensure synchronization between different variants of zone builders. - * Implementations of this interface allow the building of zone configurations - * with common methods that can be extended or specialized in concrete builders. - * </p> - * - * @param <ChildT> The specific type of the builder implementation that will be exposed to the user, enabling fluent builder patterns. - * @see ClusterZoneBuilder - */ -interface ZoneBuilderBase<ChildT> { - /** - * Sets the name of the zone. - * - * @param name The name to assign to the zone. - * @return The builder instance for chaining methods. - */ - ChildT name(String name); - - /** - * Configures the storage profiles associated with the zone. - * - * @param storageProfiles A list of storage profile names to associate with the zone. - * @return The builder instance for chaining methods. - */ - ChildT storageProfiles(List<String> storageProfiles); -}