mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed up the test suites to use getInstallURL and
asLocalURL to find the location of the test plugins.
This commit is contained in:
parent
1300bda0b8
commit
c7241a4d1a
14 changed files with 64 additions and 55 deletions
|
@ -664,18 +664,19 @@ import org.eclipse.core.runtime.Platform;
|
|||
}
|
||||
|
||||
private IFile importFile(String fileName, String resourceLocation)throws Exception{
|
||||
String testCaseName = this.getName();
|
||||
|
||||
//Obtain file handle
|
||||
file = testProject.getProject().getFile(fileName);
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
//Create file input stream
|
||||
monitor = new NullProgressMonitor();
|
||||
if (!file.exists()){
|
||||
file.create(new FileInputStream(pluginRoot + resourceLocation),false,monitor);
|
||||
}
|
||||
fileDoc = new IFileDocument(file);
|
||||
|
||||
return file;
|
||||
String testCaseName = this.getName();
|
||||
//Obtain file handle
|
||||
file = testProject.getProject().getFile(fileName);
|
||||
String pluginRoot = Platform.asLocalURL(
|
||||
Platform.getPlugin("org.eclipse.cdt.core.tests")
|
||||
.getDescriptor().getInstallURL()).getFile();
|
||||
//Create file input stream
|
||||
monitor = new NullProgressMonitor();
|
||||
if (!file.exists()) {
|
||||
file.create(new FileInputStream(pluginRoot + resourceLocation),
|
||||
false, monitor);
|
||||
}
|
||||
fileDoc = new IFileDocument(file);
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* @author bgheorgh
|
||||
|
@ -129,17 +129,20 @@ public class IndexManagerTests extends TestCase {
|
|||
return cPrj.getProject();
|
||||
}
|
||||
|
||||
private IFile importFile(String fileName, String resourceLocation)throws Exception{
|
||||
//Obtain file handle
|
||||
file = testProject.getProject().getFile(fileName);
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
//Create file input stream
|
||||
monitor = new NullProgressMonitor();
|
||||
if (!file.exists()){
|
||||
file.create(new FileInputStream(pluginRoot + resourceLocation),false,monitor);
|
||||
}
|
||||
fileDoc = new IFileDocument(file);
|
||||
return file;
|
||||
private IFile importFile(String fileName, String resourceLocation)throws Exception {
|
||||
//Obtain file handle
|
||||
file = testProject.getProject().getFile(fileName);
|
||||
String pluginRoot = Platform.asLocalURL(
|
||||
Platform.getPlugin("org.eclipse.cdt.core.tests")
|
||||
.getDescriptor().getInstallURL()).getFile();
|
||||
//Create file input stream
|
||||
monitor = new NullProgressMonitor();
|
||||
if (!file.exists()) {
|
||||
file.create(new FileInputStream(pluginRoot + resourceLocation),
|
||||
false, monitor);
|
||||
}
|
||||
fileDoc = new IFileDocument(file);
|
||||
return file;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
|
||||
|
||||
|
@ -73,13 +74,13 @@ public class ArchiveTests extends TestCase {
|
|||
* Example code test the packages in the project
|
||||
* "com.qnx.tools.ide.cdt.core"
|
||||
*/
|
||||
protected void setUp() throws CoreException,FileNotFoundException {
|
||||
protected void setUp() throws Exception {
|
||||
|
||||
/***
|
||||
* Setup the various files, paths and projects that are needed by the
|
||||
* tests
|
||||
*/
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
String pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
testProject=CProjectHelper.createCProject("filetest", "none");
|
||||
if (testProject==null)
|
||||
fail("Unable to create project");
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
|
||||
|
||||
|
@ -63,7 +64,7 @@ public class BinaryTests extends TestCase {
|
|||
* Example code test the packages in the project
|
||||
* "com.qnx.tools.ide.cdt.core"
|
||||
*/
|
||||
protected void setUp() throws CoreException,FileNotFoundException {
|
||||
protected void setUp() throws Exception {
|
||||
String pluginRoot;
|
||||
/***
|
||||
* The tests assume that they have a working workspace
|
||||
|
@ -98,7 +99,7 @@ public class BinaryTests extends TestCase {
|
|||
if (testProject==null)
|
||||
fail("Unable to create project");
|
||||
|
||||
pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
|
||||
cfile = testProject.getProject().getFile("exetest.c");
|
||||
if (!cfile.exists()) {
|
||||
|
|
|
@ -45,7 +45,7 @@ import org.eclipse.cdt.testplugin.CProjectHelper;
|
|||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
public class CModelElementsTests extends TestCase {
|
||||
private ICProject fCProject;
|
||||
|
@ -62,9 +62,10 @@ public class CModelElementsTests extends TestCase {
|
|||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() {
|
||||
protected void setUp() throws Exception {
|
||||
monitor = new NullProgressMonitor();
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
String pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL())
|
||||
.getFile();
|
||||
|
||||
fCProject= CProjectHelper.createCCProject("TestProject1", "bin");
|
||||
headerFile = fCProject.getProject().getFile("CModelElementsTest.h");
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -58,7 +59,7 @@ public class CModelTests extends TestCase {
|
|||
* Example code test the packages in the project
|
||||
* "com.qnx.tools.ide.cdt.core"
|
||||
*/
|
||||
protected void setUp() throws CoreException {
|
||||
protected void setUp() throws Exception {
|
||||
/***
|
||||
* The test of the tests assume that they have a working workspace
|
||||
* and workspace root object to use to create projects/files in,
|
||||
|
@ -72,7 +73,7 @@ public class CModelTests extends TestCase {
|
|||
fail("Workspace was not setup");
|
||||
if (root==null)
|
||||
fail("Workspace root was not setup");
|
||||
pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
desc=workspace.getDescription();
|
||||
desc.setAutoBuilding(false);
|
||||
workspace.setDescription(desc);
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.eclipse.cdt.testplugin.TestPluginLauncher;
|
|||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* Class for testing the C Element Delta Builder.
|
||||
|
@ -64,9 +64,9 @@ public class ElementDeltaTests extends TestCase implements IElementChangedListen
|
|||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() {
|
||||
protected void setUp() throws Exception {
|
||||
monitor = new NullProgressMonitor();
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
String pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
|
||||
fCProject= CProjectHelper.createCCProject("TestProject1", "bin");
|
||||
//Path filePath = new Path(ResourcesPlugin.getWorkspace().getRoot().getLocation().toString()+ fCProject.getPath().toString()+ "/WorkingCopyTest.h");
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.eclipse.cdt.testplugin.CProjectHelper;
|
|||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* @author bnicolle
|
||||
|
@ -54,9 +54,9 @@ public abstract class IntegratedCModelTest extends TestCase {
|
|||
*/
|
||||
abstract public String getSourcefileResource();
|
||||
|
||||
public void setUp() {
|
||||
public void setUp() throws Exception {
|
||||
monitor = new NullProgressMonitor();
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
String pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
|
||||
fCProject= CProjectHelper.createCCProject("TestProject1", "bin");
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -71,7 +72,7 @@ public class TranslationUnitBaseTest extends TestCase
|
|||
* Example code test the packages in the project
|
||||
* "com.qnx.tools.ide.cdt.core"
|
||||
*/
|
||||
protected void setUp() throws CoreException, FileNotFoundException
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
/***
|
||||
* The rest of the tests assume that they have a working workspace
|
||||
|
@ -79,7 +80,7 @@ public class TranslationUnitBaseTest extends TestCase
|
|||
* so we need to get them setup first.
|
||||
*/
|
||||
IWorkspaceDescription desc;
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
String pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
workspace= ResourcesPlugin.getWorkspace();
|
||||
root= workspace.getRoot();
|
||||
monitor = new NullProgressMonitor();
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.eclipse.cdt.testplugin.TestPluginLauncher;
|
|||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* Contains unit test cases for Working Copies. Run using JUnit Plugin Test
|
||||
|
@ -54,9 +54,9 @@ public class WorkingCopyTests extends TestCase {
|
|||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() {
|
||||
protected void setUp() throws Exception {
|
||||
monitor = new NullProgressMonitor();
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
String pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
|
||||
fCProject= CProjectHelper.createCCProject("TestProject1", "bin");
|
||||
//Path filePath = new Path(ResourcesPlugin.getWorkspace().getRoot().getLocation().toString()+ fCProject.getPath().toString()+ "/WorkingCopyTest.h");
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.eclipse.core.resources.IWorkspace;
|
|||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
|
@ -106,10 +106,10 @@ public class BaseSearchTest extends TestCase implements ICSearchConstants {
|
|||
return cPrj.getProject();
|
||||
}
|
||||
|
||||
private void importFile(String fileName, String resourceLocation)throws Exception{
|
||||
private void importFile(String fileName, String resourceLocation) throws Exception{
|
||||
//Obtain file handle
|
||||
file = testProject.getProject().getFile(fileName);
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
String pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
//Create file input stream
|
||||
|
||||
if (!file.exists()){
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.eclipse.cdt.internal.core.search.matching.MatchLocator;
|
|||
import org.eclipse.cdt.internal.core.search.matching.NamespaceDeclarationPattern;
|
||||
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
|
@ -317,8 +317,8 @@ public class OtherPatternTests extends BaseSearchTest {
|
|||
assertEquals( matches.size(), 2 );
|
||||
}
|
||||
|
||||
public void testNoResourceSearching(){
|
||||
String pluginRoot = org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
public void testNoResourceSearching() throws Exception {
|
||||
String pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
String path = pluginRoot + "resources/search/include.h";
|
||||
|
||||
ICSearchPattern pattern = SearchEngine.createSearchPattern( "Head", CLASS, REFERENCES, true );
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.eclipse.cdt.core.parser.ParserFactory;
|
|||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -51,7 +51,7 @@ public class ParseTestOnSearchFiles extends TestCase
|
|||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
|
||||
pluginRoot = Platform.asLocalURL(Platform.getPlugin("org.eclipse.cdt.core.tests").getDescriptor().getInstallURL()).getFile();
|
||||
name = pluginRoot+ "resources/search/classDecl.cpp";
|
||||
fileIn = new FileInputStream(name);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.eclipse.core.resources.IProjectDescription;
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.text.Document;
|
||||
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||
|
||||
|
@ -75,7 +75,7 @@ public abstract class CompletionProposalsBaseTest extends TestCase{
|
|||
|
||||
protected void setUp() throws Exception {
|
||||
monitor = new NullProgressMonitor();
|
||||
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin(pluginName).find(new Path("/")).getFile();
|
||||
String pluginRoot = Platform.asLocalURL(Platform.getPlugin(pluginName).getDescriptor().getInstallURL()).getFile();
|
||||
|
||||
fCProject= CProjectHelper.createCProject(projectName, projectType);
|
||||
fHeaderFile = fCProject.getProject().getFile(getHeaderFileName());
|
||||
|
|
Loading…
Add table
Reference in a new issue