Search in sources :

Example 1 with PruneTask

use of com.android.tools.idea.res.ResourceFolderRepositoryFileCacheImpl.PruneTask in project android by JetBrains.

the class ResourceFolderRepositoryFileCacheTest method testPruneResourceCachesInProject.

public void testPruneResourceCachesInProject() throws IOException {
    ResourceFolderRepositoryFileCache cache = ResourceFolderRepositoryFileCacheService.get();
    VirtualFile resourceDir = getResourceDir();
    File resourceCacheDir = cache.getResourceDir(getProject(), resourceDir);
    assertNotNull(resourceCacheDir);
    FileUtil.ensureExists(resourceCacheDir);
    // Add a dummy directories alongside the real cache directory.
    File dummyDirectory = new File(resourceCacheDir.getParent(), "dummyResDirCache");
    FileUtil.ensureExists(dummyDirectory);
    assertTrue(dummyDirectory.exists());
    // Now prune.
    PruneTask pruneTask = new PruneTask(getProject());
    pruneTask.performInDumbMode(new MockProgressIndicator());
    assertFalse(dummyDirectory.exists());
    assertTrue(resourceCacheDir.exists());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) PruneTask(com.android.tools.idea.res.ResourceFolderRepositoryFileCacheImpl.PruneTask) MockProgressIndicator(com.intellij.mock.MockProgressIndicator) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

PruneTask (com.android.tools.idea.res.ResourceFolderRepositoryFileCacheImpl.PruneTask)1 MockProgressIndicator (com.intellij.mock.MockProgressIndicator)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1