Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2013-02-05 21:27:50 +0000
committerSergey Prigogin2013-02-05 22:08:31 +0000
commit3ea87ef826db98b9f084a6d2a56237567cc49ea5 (patch)
tree0236fab7d756b5a65f0f2212530006013eaf453c
parent9464c4849152472941a522298f46dc70e00683ce (diff)
downloadorg.eclipse.cdt-3ea87ef826db98b9f084a6d2a56237567cc49ea5.tar.gz
org.eclipse.cdt-3ea87ef826db98b9f084a6d2a56237567cc49ea5.tar.xz
org.eclipse.cdt-3ea87ef826db98b9f084a6d2a56237567cc49ea5.zip
Use the configurable index timeout.
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCompositeTests.java102
1 files changed, 50 insertions, 52 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCompositeTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCompositeTests.java
index b1ba0f5c4e4..dcd0d675d78 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCompositeTests.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCompositeTests.java
@@ -46,6 +46,54 @@ import org.eclipse.core.runtime.Path;
* Tests the behavior of the IIndex API when dealing with multiple projects
*/
public class IndexCompositeTests extends BaseTestCase {
+ /*
+ * Convenience class for setting up projects.
+ */
+ private static class ProjectBuilder {
+ private final String name;
+ private final boolean cpp;
+ private List dependencies = new ArrayList();
+ private Map path2content = new HashMap();
+
+ ProjectBuilder(String name, boolean cpp) {
+ this.name = name;
+ this.cpp = cpp;
+ }
+
+ ProjectBuilder addDependency(IProject project) {
+ dependencies.add(project);
+ return this;
+ }
+
+ ProjectBuilder addFile(String relativePath, CharSequence content) {
+ path2content.put(relativePath, content.toString());
+ return this;
+ }
+
+ ICProject create() throws Exception {
+ ICProject result = cpp ?
+ CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER) :
+ CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER);
+
+ IFile lastFile= null;
+ for (Iterator i = path2content.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry) i.next();
+ lastFile= TestSourceReader.createFile(result.getProject(), new Path((String)entry.getKey()), (String) entry.getValue());
+ }
+
+ IProjectDescription desc = result.getProject().getDescription();
+ desc.setReferencedProjects((IProject[]) dependencies.toArray(new IProject[dependencies.size()]));
+ result.getProject().setDescription(desc, new NullProgressMonitor());
+
+ CCorePlugin.getIndexManager().setIndexerId(result, IPDOMManager.ID_FAST_INDEXER);
+ if (lastFile != null) {
+ IIndex index= CCorePlugin.getIndexManager().getIndex(result);
+ TestSourceReader.waitUntilFileIsIndexed(index, lastFile, INDEXER_TIMEOUT_SEC * 1000);
+ }
+ BaseTestCase.waitForIndexer(result);
+ return result;
+ }
+ }
public static Test suite() {
return suite(IndexCompositeTests.class);
@@ -438,13 +486,13 @@ public class IndexCompositeTests extends BaseTestCase {
private void assertNamespaceXMemberCount(int count) throws CoreException, DOMException {
IBinding[] bindings = index.findBindings(Pattern.compile("X"), true, FILTER, new NullProgressMonitor());
assertEquals(1, bindings.length);
- assertEquals(count, ((ICPPNamespace)bindings[0]).getMemberBindings().length);
+ assertEquals(count, ((ICPPNamespace) bindings[0]).getMemberBindings().length);
}
private void assertFieldCount(String qnPattern, int count) throws CoreException, DOMException {
IBinding[] bindings = index.findBindings(Pattern.compile(qnPattern), true, FILTER, new NullProgressMonitor());
assertEquals(1, bindings.length);
- assertEquals(count, ((ICompositeType)bindings[0]).getFields().length);
+ assertEquals(count, ((ICompositeType) bindings[0]).getFields().length);
}
private void setIndex(ICProject project, int options) throws CoreException, InterruptedException {
@@ -463,53 +511,3 @@ public class IndexCompositeTests extends BaseTestCase {
super.tearDown();
}
}
-
-/*
- * Convenience class for setting up projects.
- */
-class ProjectBuilder {
- private static final int INDEXER_TIMEOUT_SEC = 10;
- private final String name;
- private final boolean cpp;
- private List dependencies = new ArrayList();
- private Map path2content = new HashMap();
-
- ProjectBuilder(String name, boolean cpp) {
- this.name = name;
- this.cpp = cpp;
- }
-
- ProjectBuilder addDependency(IProject project) {
- dependencies.add(project);
- return this;
- }
-
- ProjectBuilder addFile(String relativePath, CharSequence content) {
- path2content.put(relativePath, content.toString());
- return this;
- }
-
- ICProject create() throws Exception {
- ICProject result = cpp ?
- CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER) :
- CProjectHelper.createCCProject(name, "bin", IPDOMManager.ID_NO_INDEXER);
-
- IFile lastFile= null;
- for (Iterator i = path2content.entrySet().iterator(); i.hasNext();) {
- Map.Entry entry = (Map.Entry) i.next();
- lastFile= TestSourceReader.createFile(result.getProject(), new Path((String)entry.getKey()), (String) entry.getValue());
- }
-
- IProjectDescription desc = result.getProject().getDescription();
- desc.setReferencedProjects((IProject[]) dependencies.toArray(new IProject[dependencies.size()]));
- result.getProject().setDescription(desc, new NullProgressMonitor());
-
- CCorePlugin.getIndexManager().setIndexerId(result, IPDOMManager.ID_FAST_INDEXER);
- if (lastFile != null) {
- IIndex index= CCorePlugin.getIndexManager().getIndex(result);
- TestSourceReader.waitUntilFileIsIndexed(index, lastFile, INDEXER_TIMEOUT_SEC * 1000);
- }
- BaseTestCase.waitForIndexer(result);
- return result;
- }
-}

Back to the top