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.ObjectHelper 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.IProjectprojectDefault 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 voidaddNature(org.eclipse.core.resources.IProject project, java.lang.String natureId)Adds a nature of the given id to the given projectprotected static voidchangeFileContents(org.eclipse.core.resources.IFile file, java.lang.String newContents)Changes the content of the given fileprotected static org.eclipse.core.resources.IFilecreateEmptyFile(org.eclipse.core.resources.IProject project, java.lang.String name)Creates an empty file in the given projectprotected static org.eclipse.core.resources.IFilecreateFile(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.IFilecreateFile(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.IFoldercreateFolder(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.IProjectcreateProject(java.lang.String name)protected static voiddeleteResource(org.eclipse.core.resources.IResource resource)Delete the given resourceprotected static org.eclipse.core.resources.IFilemoveFile(org.eclipse.core.resources.IFile file, java.lang.String newPath)Moves the given file to newPathprotected static voidprintFileContents(org.eclipse.core.resources.IFile file)Print the contents of the given file toSystem.errprotected static voidrefreshContents(org.eclipse.core.resources.IResource resource)Refreshes the given resource (and all its child resources) in the workspace (and sleep for 1 second)voidsetupProject()voidteardownProject() 
 - 
 
- 
- 
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.CoreExceptionCreates 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.CoreExceptionCreates 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.CoreExceptionCreates 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.IOExceptionCreates a file in the given project with the contents of the given resource- Returns:
 - the file object
 - Throws:
 org.eclipse.core.runtime.CoreExceptionjava.io.IOException
 
- 
changeFileContents
protected static void changeFileContents(org.eclipse.core.resources.IFile file, java.lang.String newContents) throws org.eclipse.core.runtime.CoreExceptionChanges 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.InterruptedExceptionRefreshes the given resource (and all its child resources) in the workspace (and sleep for 1 second)- Throws:
 org.eclipse.core.runtime.CoreExceptionjava.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.CoreExceptionMoves 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.CoreExceptionDelete 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.CoreExceptionPrint the contents of the given file toSystem.err- Throws:
 java.io.IOExceptionorg.eclipse.core.runtime.CoreException
 
- 
addNature
protected static void addNature(org.eclipse.core.resources.IProject project, java.lang.String natureId) throws org.eclipse.core.runtime.CoreExceptionAdds a nature of the given id to the given project- Throws:
 org.eclipse.core.runtime.CoreException
 
 - 
 
 -