use of com.intellij.mock.MockProgressIndicator in project intellij-community by JetBrains.
the class CodeInsightTestFixtureImpl method getGotoClassResults.
@NotNull
@Override
public List<Object> getGotoClassResults(@NotNull String pattern, boolean searchEverywhere, @Nullable PsiElement contextForSorting) {
final ChooseByNameBase chooseByNamePopup = getMockChooseByNamePopup(contextForSorting);
final ArrayList<Object> results = new ArrayList<>();
chooseByNamePopup.getProvider().filterElements(chooseByNamePopup, chooseByNamePopup.transformPattern(pattern), searchEverywhere, new MockProgressIndicator(), new CommonProcessors.CollectProcessor<>(results));
return results;
}
use of com.intellij.mock.MockProgressIndicator 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());
}
use of com.intellij.mock.MockProgressIndicator in project android by JetBrains.
the class ResourceFolderRepositoryFileCacheTest method testCacheVersionCheck.
public void testCacheVersionCheck() throws IOException {
ResourceFolderRepositoryFileCacheImpl cache = (ResourceFolderRepositoryFileCacheImpl) ResourceFolderRepositoryFileCacheService.get();
// Creating the root dir the first time gives us a stamp file.
File rootDir = cache.getRootDir();
assertNotNull(rootDir);
assertTrue(cache.isVersionSame(rootDir));
// If we delete the cache, it'll be empty without a stamp file.
cache.delete();
assertFalse(rootDir.exists());
assertFalse(cache.isVersionSame(rootDir));
// If we imagine a situation before the stamp file was introduced into the codebase
// (root dir is made and it has content, but no stamp file) it is not valid.
assertTrue(rootDir.mkdirs());
List<File> files = addProjectDirectories(3, 0);
for (File file : files) {
assertTrue(file.exists());
}
assertFalse(cache.isVersionSame(rootDir));
assertFalse(cache.isValid());
// Now try setting up the correct version and a few directories (stamping happens automatically).
cache.delete();
files = addProjectDirectories(3, 0);
for (File file : files) {
assertTrue(file.exists());
}
assertTrue(cache.isVersionSame(rootDir));
assertTrue(cache.isValid());
// Now try overwriting version stamp with a too old version.
cache.stampVersion(rootDir, ResourceFolderRepositoryFileCacheImpl.EXPECTED_CACHE_VERSION - 1);
assertFalse(cache.isVersionSame(rootDir));
assertFalse(cache.isValid());
// The management task should clean up old files if the version is invalid.
ManageLruProjectFilesTask task = new ManageLruProjectFilesTask(getProject());
task.performInDumbMode(new MockProgressIndicator());
assertFalse(rootDir.exists());
for (File file : files) {
assertFalse(file.exists());
}
assertFalse(cache.isVersionSame(rootDir));
// However, once anything grabs the root dir again, it is stamped and valid again.
rootDir = cache.getRootDir();
assertNotNull(rootDir);
assertTrue(cache.isVersionSame(rootDir));
assertTrue(cache.isValid());
}
Aggregations