Search in sources :

Example 1 with IgniteTableImpl

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"));
}
Also used : InternalTable(org.apache.ignite.internal.table.InternalTable) Table(org.apache.calcite.schema.Table) IgniteTable(org.apache.ignite.internal.sql.engine.schema.IgniteTable) IgniteTableImpl(org.apache.ignite.internal.sql.engine.schema.IgniteTableImpl) InternalTable(org.apache.ignite.internal.table.InternalTable) Test(org.junit.jupiter.api.Test)

Aggregations

Table (org.apache.calcite.schema.Table)1 IgniteTable (org.apache.ignite.internal.sql.engine.schema.IgniteTable)1 IgniteTableImpl (org.apache.ignite.internal.sql.engine.schema.IgniteTableImpl)1 InternalTable (org.apache.ignite.internal.table.InternalTable)1 Test (org.junit.jupiter.api.Test)1