Class TestThatUsesAProject

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.eclipse.core.resources.IProject project
      Default project, available to the tests.
    • 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 project
      protected static void changeFileContents​(org.eclipse.core.resources.IFile file, java.lang.String newContents)
      Changes the content of the given file
      protected static org.eclipse.core.resources.IFile createEmptyFile​(org.eclipse.core.resources.IProject project, java.lang.String name)
      Creates an empty file in the given project
      protected 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 contents
      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)
      Creates a file in the given project with the contents of the given resource
      protected 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 name
      protected static org.eclipse.core.resources.IProject createProject​(java.lang.String name)  
      protected static void deleteResource​(org.eclipse.core.resources.IResource resource)
      Delete the given resource
      protected static org.eclipse.core.resources.IFile moveFile​(org.eclipse.core.resources.IFile file, java.lang.String newPath)
      Moves the given file to newPath
      protected static void printFileContents​(org.eclipse.core.resources.IFile file)
      Print the contents of the given file to System.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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • project

        protected org.eclipse.core.resources.IProject project
        Default project, available to the tests. It is cleaned between tests
    • Constructor Detail

      • TestThatUsesAProject

        public TestThatUsesAProject()
    • 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 to System.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