1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

update test to Eclipse 3.0

This commit is contained in:
David Inglis 2004-06-28 20:26:26 +00:00
parent 1662c1895f
commit 6b222b30ad
5 changed files with 637 additions and 631 deletions

View file

@ -26,6 +26,7 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@ -78,9 +79,8 @@ public class DebugTests extends TestCase {
/***
* Create a new project and import the test source.
*/
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.debug.ui.tests").find(new Path("/")).getFile();
pluginRoot=pluginRoot+"resources/debugTest.zip";
testProject=CProjectHelper.createCProjectWithImport("filetest", pluginRoot);
IPath importFile = new Path("resources/debugTest.zip");
testProject=CProjectHelper.createCProjectWithImport("filetest", importFile);
if (testProject==null)
fail("Unable to create project");
/* Build the test project.. */

View file

@ -27,6 +27,7 @@ import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@ -79,9 +80,8 @@ public class LocationTests extends TestCase {
/***
* Create a new project and import the test source.
*/
String pluginRoot=org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.debug.ui.tests").find(new Path("/")).getFile();
pluginRoot=pluginRoot+"resources/debugTest.zip";
testProject=CProjectHelper.createCProjectWithImport("filetest", pluginRoot);
IPath importFile = new Path("resources/debugTest.zip");
testProject=CProjectHelper.createCProjectWithImport("filetest", importFile);
if (testProject==null)
fail("Unable to create project");
/* Build the test project.. */

View file

@ -1,5 +1,6 @@
package org.eclipse.cdt.debug.testplugin;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.zip.ZipFile;
@ -35,7 +36,7 @@ public class CProjectHelper {
/**
* Creates a ICProject.
*/
public static ICProject createCProjectWithImport(String projectName, String zipFile) throws CoreException, InvocationTargetException, IOException {
public static ICProject createCProjectWithImport(String projectName, IPath zipFile) throws CoreException, InvocationTargetException, IOException {
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
IProject project= root.getProject(projectName);
if (!project.exists()) {
@ -47,7 +48,8 @@ public class CProjectHelper {
if (!project.isOpen()) {
project.open(null);
}
importFilesFromZip(new ZipFile(zipFile),project.getFullPath(),null);
File zip = CTestPlugin.getDefault().getFileInPlugin(zipFile);
importFilesFromZip(new ZipFile(zip),project.getFullPath(),null);
if (!project.hasNature(CProjectNature.C_NATURE_ID)) {
addNatureToProject(project, CProjectNature.C_NATURE_ID, null);