sashapolo commented on code in PR #1014: URL: https://github.com/apache/ignite-3/pull/1014#discussion_r947816202
########## modules/storage-api/src/test/java/org/apache/ignite/internal/storage/index/AbstractHashIndexStorageTest.java: ########## @@ -0,0 +1,222 @@ +/* + * 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.storage.index; + +import static org.apache.ignite.internal.schema.configuration.SchemaConfigurationConverter.convert; +import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willBe; +import static org.apache.ignite.internal.testframework.matchers.CompletableFutureMatcher.willCompleteSuccessfully; +import static org.apache.ignite.schema.SchemaBuilders.column; +import static org.apache.ignite.schema.SchemaBuilders.tableBuilder; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.empty; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + +import java.util.concurrent.CompletableFuture; +import org.apache.ignite.configuration.schemas.table.ConstantValueDefaultConfigurationSchema; +import org.apache.ignite.configuration.schemas.table.FunctionCallDefaultConfigurationSchema; +import org.apache.ignite.configuration.schemas.table.HashIndexConfigurationSchema; +import org.apache.ignite.configuration.schemas.table.NullValueDefaultConfigurationSchema; +import org.apache.ignite.configuration.schemas.table.TableConfiguration; +import org.apache.ignite.configuration.schemas.table.TableView; +import org.apache.ignite.internal.configuration.testframework.ConfigurationExtension; +import org.apache.ignite.internal.configuration.testframework.InjectConfiguration; +import org.apache.ignite.internal.storage.RowId; +import org.apache.ignite.internal.storage.chm.TestConcurrentHashMapStorageEngine; +import org.apache.ignite.internal.storage.chm.schema.TestConcurrentHashMapDataStorageConfigurationSchema; +import org.apache.ignite.internal.storage.index.impl.BinaryTupleRowSerializer; +import org.apache.ignite.schema.SchemaBuilders; +import org.apache.ignite.schema.definition.ColumnDefinition; +import org.apache.ignite.schema.definition.ColumnType; +import org.apache.ignite.schema.definition.TableDefinition; +import org.apache.ignite.schema.definition.index.HashIndexDefinition; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +/** + * Base class for Hash Index storage tests. + */ +@ExtendWith(ConfigurationExtension.class) +public abstract class AbstractHashIndexStorageTest { + private static final String INT_COLUMN_NAME = "intVal"; + + private static final String STR_COLUMN_NAME = "strVal"; + + private TableConfiguration tableCfg; + + private HashIndexStorage indexStorage; + + private BinaryTupleRowSerializer serializer; + + @BeforeEach + void setUp(@InjectConfiguration( + polymorphicExtensions = { + HashIndexConfigurationSchema.class, + TestConcurrentHashMapDataStorageConfigurationSchema.class, + ConstantValueDefaultConfigurationSchema.class, + FunctionCallDefaultConfigurationSchema.class, + NullValueDefaultConfigurationSchema.class + }, + // This value only required for configuration validity, it's not used otherwise. + value = "mock.dataStorage.name = " + TestConcurrentHashMapStorageEngine.ENGINE_NAME + ) TableConfiguration tableCfg) { + createTestTable(tableCfg); + + this.tableCfg = tableCfg; + this.indexStorage = createIndexStorage(); + this.serializer = new BinaryTupleRowSerializer(indexStorage.indexDescriptor()); + } + + /** + * Configures a test table with columns of all supported types. Review Comment: oh, that's a copy-paste mistake, will fix it, thank you -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
