Class TestThatUsesAProject
- java.lang.Object
-
- org.eclipse.epsilon.common.dt.test.util.TestThatUsesAProject
-
- Direct Known Subclasses:
BuilderConfiguringNatureTests
,EmfModelLoadPropertiesTests.MetamodelsCanBeLoadedFromPlatformAndFileBasedURIs
,EmfModelLoadPropertiesTests.MetamodelsCanBeLoadedFromTheEPackageRegistry
,EmfModelLoadPropertiesTests.ModelsCanBeLoadedFromPlatformAndFileBasedURIs
,ToggleNatureActionTests
public class TestThatUsesAProject extends java.lang.Object
Helper class that provides some basic project/workspace related functionality. A clean project called 'sample' is provided for each test.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.core.resources.IProject
project
Default project, available to the tests.
-
Constructor Summary
Constructors Constructor Description TestThatUsesAProject()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static void
addNature(org.eclipse.core.resources.IProject project, java.lang.String natureId)
Adds a nature of the given id to the given projectprotected static void
changeFileContents(org.eclipse.core.resources.IFile file, java.lang.String newContents)
Changes the content of the given fileprotected static org.eclipse.core.resources.IFile
createEmptyFile(org.eclipse.core.resources.IProject project, java.lang.String name)
Creates an empty file in the given projectprotected static org.eclipse.core.resources.IFile
createFile(org.eclipse.core.resources.IProject project, java.lang.String name, java.lang.String contents)
Creates a file in the given project with the provided contentsprotected static org.eclipse.core.resources.IFile
createFile(org.eclipse.core.resources.IProject project, java.lang.String name, org.eclipse.emf.common.util.URI resourceToCopy)
Creates a file in the given project with the contents of the given resourceprotected static org.eclipse.core.resources.IFolder
createFolder(org.eclipse.core.resources.IProject project, java.lang.String name)
Creates a new folder in the given project with the given nameprotected static org.eclipse.core.resources.IProject
createProject(java.lang.String name)
protected static void
deleteResource(org.eclipse.core.resources.IResource resource)
Delete the given resourceprotected static org.eclipse.core.resources.IFile
moveFile(org.eclipse.core.resources.IFile file, java.lang.String newPath)
Moves the given file to newPathprotected static void
printFileContents(org.eclipse.core.resources.IFile file)
Print the contents of the given file toSystem.err
protected static void
refreshContents(org.eclipse.core.resources.IResource resource)
Refreshes the given resource (and all its child resources) in the workspace (and sleep for 1 second)void
setupProject()
void
teardownProject()
-
-
-
Method Detail
-
setupProject
public void setupProject() throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
teardownProject
public void teardownProject() throws org.eclipse.core.runtime.CoreException
- Throws:
org.eclipse.core.runtime.CoreException
-
createProject
protected static org.eclipse.core.resources.IProject createProject(java.lang.String name) throws org.eclipse.core.runtime.CoreException
- Returns:
- the newly created project
- Throws:
org.eclipse.core.runtime.CoreException
-
createFolder
protected static org.eclipse.core.resources.IFolder createFolder(org.eclipse.core.resources.IProject project, java.lang.String name) throws org.eclipse.core.runtime.CoreException
Creates a new folder in the given project with the given name- Returns:
- the folder object
- Throws:
org.eclipse.core.runtime.CoreException
-
createEmptyFile
protected static org.eclipse.core.resources.IFile createEmptyFile(org.eclipse.core.resources.IProject project, java.lang.String name) throws org.eclipse.core.runtime.CoreException
Creates an empty file in the given project- Returns:
- the file object
- Throws:
org.eclipse.core.runtime.CoreException
-
createFile
protected static org.eclipse.core.resources.IFile createFile(org.eclipse.core.resources.IProject project, java.lang.String name, java.lang.String contents) throws org.eclipse.core.runtime.CoreException
Creates a file in the given project with the provided contents- Returns:
- the file object
- Throws:
org.eclipse.core.runtime.CoreException
-
createFile
protected static org.eclipse.core.resources.IFile createFile(org.eclipse.core.resources.IProject project, java.lang.String name, org.eclipse.emf.common.util.URI resourceToCopy) throws org.eclipse.core.runtime.CoreException, java.io.IOException
Creates a file in the given project with the contents of the given resource- Returns:
- the file object
- Throws:
org.eclipse.core.runtime.CoreException
java.io.IOException
-
changeFileContents
protected static void changeFileContents(org.eclipse.core.resources.IFile file, java.lang.String newContents) throws org.eclipse.core.runtime.CoreException
Changes the content of the given file- Throws:
org.eclipse.core.runtime.CoreException
-
refreshContents
protected static void refreshContents(org.eclipse.core.resources.IResource resource) throws org.eclipse.core.runtime.CoreException, java.lang.InterruptedException
Refreshes the given resource (and all its child resources) in the workspace (and sleep for 1 second)- Throws:
org.eclipse.core.runtime.CoreException
java.lang.InterruptedException
-
moveFile
protected static org.eclipse.core.resources.IFile moveFile(org.eclipse.core.resources.IFile file, java.lang.String newPath) throws org.eclipse.core.runtime.CoreException
Moves the given file to newPath- Returns:
- the file object of the moved file
- Throws:
org.eclipse.core.runtime.CoreException
-
deleteResource
protected static void deleteResource(org.eclipse.core.resources.IResource resource) throws org.eclipse.core.runtime.CoreException
Delete the given resource- Throws:
org.eclipse.core.runtime.CoreException
-
printFileContents
protected static void printFileContents(org.eclipse.core.resources.IFile file) throws java.io.IOException, org.eclipse.core.runtime.CoreException
Print the contents of the given file toSystem.err
- Throws:
java.io.IOException
org.eclipse.core.runtime.CoreException
-
addNature
protected static void addNature(org.eclipse.core.resources.IProject project, java.lang.String natureId) throws org.eclipse.core.runtime.CoreException
Adds a nature of the given id to the given project- Throws:
org.eclipse.core.runtime.CoreException
-
-