tkalkirill commented on code in PR #1833:
URL: https://github.com/apache/ignite-3/pull/1833#discussion_r1145794193
##########
modules/index/src/test/java/org/apache/ignite/internal/index/IndexManagerTest.java:
##########
@@ -92,100 +64,57 @@
*/
@ExtendWith(ConfigurationExtension.class)
public class IndexManagerTest {
- /** Configuration registry with one table for each test. */
- private static ConfigurationRegistry confRegistry;
-
- /** Tables configuration. */
- private static TablesConfiguration tablesConfig;
-
- /** Index manager. */
- private static IndexManager indexManager;
-
- /** Per test unique index name. */
- private static AtomicInteger index = new AtomicInteger();
-
- /**
- * Common components initialization.
- */
- @BeforeAll
- public static void setUp() throws Exception {
- confRegistry = new ConfigurationRegistry(
- List.of(TablesConfiguration.KEY),
- Set.of(IndexValidatorImpl.INSTANCE,
TableValidatorImpl.INSTANCE),
- new TestConfigurationStorage(DISTRIBUTED),
- List.of(ExtendedTableConfigurationSchema.class),
- List.of(
- HashIndexConfigurationSchema.class,
- SortedIndexConfigurationSchema.class,
-
- UnknownDataStorageConfigurationSchema.class,
- ConstantValueDefaultConfigurationSchema.class,
- FunctionCallDefaultConfigurationSchema.class,
- NullValueDefaultConfigurationSchema.class
- )
- );
+ @InjectConfiguration(
+ "mock.tables.tName {"
+ + "columns.c1 {type.type: STRING}, "
+ + "columns.c2 {type.type: STRING}, "
+ + "primaryKey {columns: [c1], colocationColumns: [c1]}"
+ + "}"
+ )
+ private TablesConfiguration tablesConfig;
- confRegistry.start();
+ private IndexManager indexManager;
- tablesConfig = confRegistry.getConfiguration(TablesConfiguration.KEY);
-
- TableManager tableManagerMock = Mockito.mock(TableManager.class);
- Map<UUID, TableImpl> tables = Mockito.mock(Map.class);
+ @BeforeEach
+ public void setUp() {
+ TableManager tableManagerMock = mock(TableManager.class);
when(tableManagerMock.tableAsync(anyLong(),
any(UUID.class))).thenAnswer(inv -> {
- InternalTable tbl = Mockito.mock(InternalTable.class);
+ InternalTable tbl = mock(InternalTable.class);
+
Mockito.doReturn(inv.getArgument(1)).when(tbl).tableId();
- return CompletableFuture.completedFuture(
- new TableImpl(tbl, new HeapLockManager(), () ->
CompletableFuture.completedFuture(List.of())));
+
+ return completedFuture(new TableImpl(tbl, new HeapLockManager(),
() -> completedFuture(List.of())));
});
SchemaManager schManager = mock(SchemaManager.class);
- when(schManager.schemaRegistry(anyLong(),
any())).thenReturn(CompletableFuture.completedFuture(null));
+
+ when(schManager.schemaRegistry(anyLong(),
any())).thenReturn(completedFuture(null));
indexManager = new IndexManager(tablesConfig, schManager,
tableManagerMock);
indexManager.start();
Review Comment:
Fix it
--
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]