API PlatformTestUtil.waitUntilBusy -> waitWhileBusy

This commit is contained in:
Anton Makeev
2017-12-21 17:30:54 +01:00
parent 0a5f90bc19
commit ff1842bfda
7 changed files with 21 additions and 105 deletions
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.projectView;
@@ -132,7 +120,7 @@ public class NavigateFromSourceTest extends BaseProjectViewTestCase {
psiClass = psiFile.getClasses()[0];
pane.select(psiClass, virtualFile, true);
PlatformTestUtil.waitUntilBusy(tree);
PlatformTestUtil.waitWhileBusy(tree);
PlatformTestUtil.assertTreeEqual(tree, expected, true);
}
}
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.projectView;
@@ -249,7 +237,7 @@ public class ProjectTreeSortingTest extends BaseProjectViewTestCase {
private void assertTree(String expected) {
TreePath path = PlatformTestUtil.waitForPromise(myPane.promisePathToElement(getContentDirectory()));
PlatformTestUtil.waitUntilBusy(myPane.getTree());
PlatformTestUtil.waitWhileBusy(myPane.getTree());
Object element = path.getLastPathComponent();
assertNotNull("Element for " + getContentDirectory() + " not found", element);
assertEquals(expected, PlatformTestUtil.print(myPane.getTree(), element, new Queryable.PrintInfo(), false));
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.projectView;
@@ -50,7 +38,7 @@ public class ProjectViewUpdatingTest extends BaseProjectViewTestCase {
final AbstractProjectViewPSIPane pane = myStructure.createPane();
getProjectTreeStructure().setProviders();
pane.select(element, element.getContainingFile().getVirtualFile(), true);
PlatformTestUtil.waitUntilBusy(pane.getTree());
PlatformTestUtil.waitWhileBusy(pane.getTree());
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" +
" -PsiDirectory: standardProviders\n" +
" -PsiDirectory: src\n" +
@@ -102,7 +90,7 @@ public class ProjectViewUpdatingTest extends BaseProjectViewTestCase {
final PsiClass aClass = classFile.getClasses()[0];
final PsiFile containingFile = aClass.getContainingFile();
pane.select(aClass, containingFile.getVirtualFile(), true);
PlatformTestUtil.waitUntilBusy(pane.getTree());
PlatformTestUtil.waitWhileBusy(pane.getTree());
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" +
" -PsiDirectory: updateProjectView\n" +
" -PsiDirectory: src\n" +
@@ -148,7 +136,7 @@ public class ProjectViewUpdatingTest extends BaseProjectViewTestCase {
PlatformTestUtil.waitForAlarm(600);
final PsiFile containingFile2 = aClass2.getContainingFile();
pane.select(aClass2, containingFile2.getVirtualFile(), true);
PlatformTestUtil.waitUntilBusy(pane.getTree());
PlatformTestUtil.waitWhileBusy(pane.getTree());
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" +
" -PsiDirectory: updateProjectView\n" +
" -PsiDirectory: src\n" +
@@ -181,7 +169,7 @@ public class ProjectViewUpdatingTest extends BaseProjectViewTestCase {
PsiClass aClass = classFile.getClasses()[0];
PsiFile containingFile = aClass.getContainingFile();
pane.select(aClass, containingFile.getVirtualFile(), true);
PlatformTestUtil.waitUntilBusy(pane.getTree());
PlatformTestUtil.waitWhileBusy(pane.getTree());
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" +
" -PsiDirectory: showClassMembers\n" +
" -PsiDirectory: src\n" +
@@ -228,7 +216,7 @@ public class ProjectViewUpdatingTest extends BaseProjectViewTestCase {
final PsiField lastField = aClass.getFields()[1];
pane.select(lastField, containingFile.getVirtualFile(), true);
PlatformTestUtil.waitUntilBusy(pane.getTree());
PlatformTestUtil.waitWhileBusy(pane.getTree());
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" +
" -PsiDirectory: showClassMembers\n" +
" -PsiDirectory: src\n" +
@@ -395,7 +383,7 @@ public class ProjectViewUpdatingTest extends BaseProjectViewTestCase {
AbstractTreeBuilder builder = pane.getTreeBuilder();
if (builder == null) {
pane.updateFromRoot(false);
PlatformTestUtil.waitUntilBusy(tree);
PlatformTestUtil.waitWhileBusy(tree);
PlatformTestUtil.assertTreeEqual(tree, "-Project\n" +
" -1\n" +
" +01.2\n" +
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.projectView;
@@ -137,7 +125,7 @@ public class StructureViewUpdatingTest extends TestSourceBasedTestCase {
svc.select(innerClassField, true);
PlatformTestUtil.waitUntilBusy(svc.getTree());
PlatformTestUtil.waitWhileBusy(svc.getTree());
PlatformTestUtil.assertTreeEqual(
svc.getTree(),
"-Class2.java\n" +
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.projectView;
@@ -42,7 +30,7 @@ public class TestProjectTreeStructure extends AbstractProjectTreeStructure imple
public void checkNavigateFromSourceBehaviour(PsiElement element, VirtualFile virtualFile, AbstractProjectViewPSIPane pane) {
Assert.assertNull(ProjectViewTestUtil.getNodeForElement(element, pane));
pane.select(element, virtualFile, true);
PlatformTestUtil.waitUntilBusy(pane.getTree());
PlatformTestUtil.waitWhileBusy(pane.getTree());
Assert.assertTrue(ProjectViewTestUtil.isExpanded(element, pane));
}
@@ -50,7 +38,7 @@ public class TestProjectTreeStructure extends AbstractProjectTreeStructure imple
final AbstractProjectViewPSIPane pane = new TestProjectViewPSIPane(myProject, this, 9);
pane.createComponent();
Disposer.register(this, pane);
PlatformTestUtil.waitUntilBusy(pane.getTree());
PlatformTestUtil.waitWhileBusy(pane.getTree());
return pane;
}
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.testFramework;
@@ -258,7 +246,7 @@ public class PlatformTestUtil {
public static void expand(JTree tree, int... rows) {
for (int row : rows) {
tree.expandRow(row);
waitUntilBusy(tree);
waitWhileBusy(tree);
}
}
@@ -284,7 +272,7 @@ public class PlatformTestUtil {
}
@TestOnly
public static void waitUntilBusy(JTree tree) {
public static void waitWhileBusy(JTree tree) {
assert EventQueue.isDispatchThread();
long millis = 10000L + System.currentTimeMillis();
while (isBusy(tree)) {
@@ -1,17 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.lang.properties;
@@ -115,7 +103,7 @@ public class PropertiesProjectViewTest extends LightPlatformCodeInsightFixtureTe
PsiFile psiFile = getPsiManager().findFile(myFixture.findFileInTempDir(getTestName(true) + "/xxx.properties"));
assert psiFile != null;
pane.select(psiFile, psiFile.getVirtualFile(), sortByType);
PlatformTestUtil.waitUntilBusy(pane.getTree());
PlatformTestUtil.waitWhileBusy(pane.getTree());
return pane;
}
}