use of org.apache.ignite.internal.sql.engine.schema.IgniteTableImpl in project ignite-3 by apache.
the class SqlSchemaManagerTest method testOnTableDroppedHandler.
@Test
public void testOnTableDroppedHandler() {
when(table.schemaView()).thenReturn(schemaRegistry);
when(table.name()).thenReturn("TEST_SCHEMA.T");
InternalTable mock = mock(InternalTable.class);
when(mock.tableId()).thenReturn(tableId);
when(table.internalTable()).thenReturn(mock);
when(schemaRegistry.schema()).thenReturn(schemaDescriptor);
when(schemaRegistry.lastSchemaVersion()).thenReturn(schemaDescriptor.version());
schemaManager.onTableCreated("TEST_SCHEMA", table, testRevisionRegister.actualToken() + 1);
testRevisionRegister.moveForward();
Table schemaTable = schemaManager.schema("TEST_SCHEMA").getTable("T");
assertNotNull(schemaTable);
IgniteTableImpl igniteTable = assertInstanceOf(IgniteTableImpl.class, schemaTable);
assertEquals(tableId, igniteTable.table().tableId());
schemaManager.onTableDropped("TEST_SCHEMA", table.name(), testRevisionRegister.actualToken() + 1);
testRevisionRegister.moveForward();
assertNull(schemaManager.schema("TEST_SCHEMA").getTable("T"));
}
Aggregations