use of org.apache.ignite.configuration.schemas.table.TableView in project ignite-3 by apache.
the class TableValidatorImplTest method testMisalignedIndexNamedListKeys.
/**
* Tests that index names and index keys inside a Named List must be equal.
*/
@Test
void testMisalignedIndexNamedListKeys(@InjectConfiguration(polymorphicExtensions = RocksDbDataRegionConfigurationSchema.class) DataStorageConfiguration dbCfg) {
NamedListView<TableView> oldValue = tablesCfg.tables().value();
TableConfiguration tableCfg = tablesCfg.tables().get("table");
CompletableFuture<Void> tableChangeFuture = tableCfg.indices().change(indicesChange -> indicesChange.create("ololo", indexChange -> indexChange.changeName("not ololo").convert(HashIndexChange.class).changeColNames("id")));
assertThat(tableChangeFuture, willBe(nullValue(Void.class)));
ValidationContext<NamedListView<TableView>> ctx = mockContext(oldValue, dbCfg.value());
ArgumentCaptor<ValidationIssue> issuesCaptor = validate(ctx);
assertThat(issuesCaptor.getAllValues(), hasSize(1));
assertThat(issuesCaptor.getValue().message(), is(equalTo("Index name \"not ololo\" does not match its Named List key: \"ololo\"")));
}
Aggregations