Search in sources :

Example 1 with DurableBackgroundCleanupIndexTreeTask

use of org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask in project ignite by apache.

the class LongDestroyDurableBackgroundTaskTest method testConvertOldTaskToNew.

/**
 * Checking the converting of the old problem into the new one.
 */
@Test
public void testConvertOldTaskToNew() {
    String grpName = "grpTest";
    String cacheName = "cacheTest";
    String treeName = "treeTest";
    String idxName = "idxTest";
    List<Long> pages = F.asList(100L);
    DurableBackgroundCleanupIndexTreeTask oldTask = new DurableBackgroundCleanupIndexTreeTask(pages, emptyList(), grpName, cacheName, new IndexName(cacheName, "schemaTest", "tableTest", idxName), treeName);
    DurableBackgroundTask convertedTask = oldTask.convertAfterRestoreIfNeeded();
    assertTrue(convertedTask instanceof DurableBackgroundCleanupIndexTreeTaskV2);
    assertEquals(grpName, getFieldValue(convertedTask, "grpName"));
    assertEquals(cacheName, getFieldValue(convertedTask, "cacheName"));
    assertEquals(treeName, getFieldValue(convertedTask, "oldTreeName"));
    assertNotNull(getFieldValue(convertedTask, "newTreeName"));
    assertEquals(idxName, getFieldValue(convertedTask, "idxName"));
    assertEquals(pages.size(), (int) getFieldValue(convertedTask, "segments"));
}
Also used : IndexName(org.apache.ignite.internal.cache.query.index.IndexName) DurableBackgroundTask(org.apache.ignite.internal.processors.cache.persistence.metastorage.pendingtask.DurableBackgroundTask) AtomicLong(java.util.concurrent.atomic.AtomicLong) DurableBackgroundCleanupIndexTreeTaskV2(org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2) DurableBackgroundCleanupIndexTreeTask(org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Aggregations

AtomicLong (java.util.concurrent.atomic.AtomicLong)1 IndexName (org.apache.ignite.internal.cache.query.index.IndexName)1 DurableBackgroundCleanupIndexTreeTask (org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTask)1 DurableBackgroundCleanupIndexTreeTaskV2 (org.apache.ignite.internal.cache.query.index.sorted.DurableBackgroundCleanupIndexTreeTaskV2)1 DurableBackgroundTask (org.apache.ignite.internal.processors.cache.persistence.metastorage.pendingtask.DurableBackgroundTask)1 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)1 Test (org.junit.Test)1