use of com.intellij.openapi.progress.EmptyProgressIndicator in project intellij-community by JetBrains.
the class GitChangeProviderTest method getChanges.
/**
* Marks the given files dirty in myDirtyScope, gets changes from myChangeProvider and groups the changes in the map.
* Assumes that only one change for a file has happened.
*/
protected Map<FilePath, Change> getChanges(VirtualFile... changedFiles) throws VcsException {
final List<FilePath> changedPaths = ObjectsConvertor.vf2fp(Arrays.asList(changedFiles));
// get changes
MockChangelistBuilder builder = new MockChangelistBuilder();
myChangeProvider.getChanges(myDirtyScope, builder, new EmptyProgressIndicator(), new MockChangeListManagerGate(ChangeListManager.getInstance(myProject)));
List<Change> changes = builder.getChanges();
// get changes for files
final Map<FilePath, Change> result = new HashMap<>();
for (Change change : changes) {
VirtualFile file = change.getVirtualFile();
FilePath filePath = null;
if (file == null) {
// if a file was deleted, just find the reference in the original list of files and use it.
String path = change.getBeforeRevision().getFile().getPath();
for (FilePath fp : changedPaths) {
if (FileUtil.pathsEqual(fp.getPath(), path)) {
filePath = fp;
break;
}
}
} else {
filePath = VcsUtil.getFilePath(file);
}
result.put(filePath, change);
}
return result;
}
use of com.intellij.openapi.progress.EmptyProgressIndicator in project android by JetBrains.
the class InstallTaskTest method runWithFallbackOnComplete.
@Test
public void runWithFallbackOnComplete() throws Exception {
Installer fallback = Mockito.mock(Installer.class);
Mockito.when(fallback.prepare(myProgressIndicator)).thenReturn(true);
Mockito.when(myInstaller2.complete(myProgressIndicator)).thenReturn(false);
Mockito.when(myInstaller2.getFallbackOperation()).thenReturn(fallback);
myInstallTask.run(new StudioProgressIndicatorAdapter(myProgressIndicator, new EmptyProgressIndicator()));
Mockito.verify(myInstaller).prepare(myProgressIndicator);
Mockito.verify(myInstaller2).prepare(myProgressIndicator);
Mockito.verify(myUninstaller).prepare(myProgressIndicator);
Mockito.verify(fallback).prepare(myProgressIndicator);
Mockito.verify(myInstaller).complete(myProgressIndicator);
Mockito.verify(myUninstaller).complete(myProgressIndicator);
Mockito.verify(fallback).complete(myProgressIndicator);
Mockito.verify(myInstaller2).complete(myProgressIndicator);
}
use of com.intellij.openapi.progress.EmptyProgressIndicator in project android by JetBrains.
the class InstallTaskTest method runBasic.
@Test
public void runBasic() throws Exception {
myInstallTask.run(new StudioProgressIndicatorAdapter(myProgressIndicator, new EmptyProgressIndicator()));
InOrder installer1Calls = Mockito.inOrder(myInstaller);
installer1Calls.verify(myInstaller).prepare(myProgressIndicator);
installer1Calls.verify(myInstaller).complete(myProgressIndicator);
InOrder installer2Calls = Mockito.inOrder(myInstaller2);
installer2Calls.verify(myInstaller2).prepare(myProgressIndicator);
installer2Calls.verify(myInstaller2).complete(myProgressIndicator);
InOrder uninstallerCalls = Mockito.inOrder(myUninstaller);
uninstallerCalls.verify(myUninstaller).prepare(myProgressIndicator);
uninstallerCalls.verify(myUninstaller).complete(myProgressIndicator);
}
use of com.intellij.openapi.progress.EmptyProgressIndicator in project android by JetBrains.
the class InstallTaskTest method runCallbacks.
@Test
public void runCallbacks() throws Exception {
Runnable prepareComplete = Mockito.mock(Runnable.class);
myInstallTask.setPrepareCompleteCallback(prepareComplete);
Function<List<RepoPackage>, Void> complete = (Function<List<RepoPackage>, Void>) Mockito.mock(Function.class);
myInstallTask.setCompleteCallback(complete);
myInstallTask.run(new StudioProgressIndicatorAdapter(myProgressIndicator, new EmptyProgressIndicator()));
InOrder callbackCalls = Mockito.inOrder(myInstaller, prepareComplete, complete);
callbackCalls.verify(myInstaller).prepare(myProgressIndicator);
callbackCalls.verify(prepareComplete).run();
callbackCalls.verify(myInstaller).complete(myProgressIndicator);
callbackCalls.verify(complete).apply(new ArrayList<>());
}
use of com.intellij.openapi.progress.EmptyProgressIndicator in project intellij-plugins by JetBrains.
the class AppTestBase method launchAndInitializeApplication.
private void launchAndInitializeApplication() throws Exception {
if (DesignerApplicationManager.getInstance().isApplicationClosed()) {
changeServicesImplementation();
new DesignerApplicationLauncher(myModule, new DesignerApplicationLauncher.PostTask() {
@Override
public boolean run(Module module, ProjectComponentReferenceCounter projectComponentReferenceCounter, ProgressIndicator indicator, ProblemsHolder problemsHolder) {
assertTrue(DocumentProblemManager.getInstance().toString(problemsHolder.getProblems()), problemsHolder.isEmpty());
client = (TestClient) Client.getInstance();
client.flush();
try {
assertAfterInitLibrarySets(projectComponentReferenceCounter.unregistered);
} catch (IOException e) {
throw new AssertionError(e);
}
return true;
}
}).run(new EmptyProgressIndicator());
} else {
client = (TestClient) Client.getInstance();
ProblemsHolder problemsHolder = new ProblemsHolder();
ProjectComponentReferenceCounter projectComponentReferenceCounter = LibraryManager.getInstance().registerModule(myModule, problemsHolder, isRequireLocalStyleHolder());
assertTrue(problemsHolder.isEmpty());
assertAfterInitLibrarySets(projectComponentReferenceCounter.unregistered);
}
socketInputHandler = (TestSocketInputHandler) SocketInputHandler.getInstance();
applicationLaunchedAndInitialized();
}
Aggregations