From 8e12e974ecaa731d9153e5360af000e85b65fd20 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Wed, 5 May 2010 11:50:56 +0000 Subject: [PATCH] Fix for JUnit failures. --- .../index/tests/IndexLocationTest.java | 19 ++++++++++++------- .../index/URIRelativeLocationConverter.java | 5 ++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java index 2c790fcca5d..d1df8b5351d 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexLocationTest.java @@ -56,12 +56,14 @@ public class IndexLocationTest extends BaseTestCase { return suite(IndexLocationTest.class); } + @Override protected void setUp() throws Exception { super.setUp(); cproject= CProjectHelper.createCProject("LocationTests"+System.currentTimeMillis(), "bin", IPDOMManager.ID_FAST_INDEXER); deleteOnTearDown(cproject); } + @Override protected void tearDown() throws Exception { for(Iterator i= projects.iterator(); i.hasNext(); ) { ICProject ptd= (ICProject) i.next(); @@ -180,6 +182,8 @@ public class IndexLocationTest extends BaseTestCase { public void testSameFileLinkedToOnceInTwoProjects_186214() throws Exception { File location = new File(CProjectHelper.freshDir(),"external2.h"); createExternalFile(location, "struct External {};\n"); + assertTrue(location.isFile()); + IFolder content= cproject.getProject().getFolder("content"); content.createLink(new Path(location.getParentFile().getAbsolutePath()), IResource.NONE, null); @@ -189,8 +193,9 @@ public class IndexLocationTest extends BaseTestCase { IFolder content2= cproject2.getProject().getFolder("content"); content2.createLink(new Path(location.getParentFile().getAbsolutePath()), IResource.NONE, null); + waitForIndexer(cproject2); CCorePlugin.getIndexManager().reindex(cproject); - assertTrue(CCorePlugin.getIndexManager().joinIndexer(10000, new NullProgressMonitor())); + waitForIndexer(cproject); IIndex index = CCorePlugin.getIndexManager().getIndex(cproject); index.acquireReadLock(); try { @@ -210,8 +215,8 @@ public class IndexLocationTest extends BaseTestCase { deleteOnTearDown(emptyCProject); String[] paths = new String[] {"this.cpp", "inc/header.h", "a b c/d/e f/g.h", "a \\b /c.d"}; - for(int i=0; i raw -uri-> loc for(int i=0; i raw -uri-> loc + URI base = URI.create("file:/" + basePath); + URIRelativeLocationConverter c1 = new URIRelativeLocationConverter(base); for(int i=0; i 0 && rawPath.charAt(0) == '/') + rawPath= rawPath.substring(1); + URI uri= baseURI.resolve(rawPath); return new IndexFileLocation(uri, null); }