org.eclipse.core.tests.resources
Class ResourceTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.eclipse.core.tests.harness.CoreTest
              extended by org.eclipse.core.tests.resources.ResourceTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractBuilderTest, BasicAliasTest, BenchFileStore, BenchMiscWorkspace, BenchWorkspace, BucketTreeTests, Bug_006708, Bug_025457, Bug_026294, Bug_027271, Bug_028981, Bug_029116, Bug_029671, Bug_029851, Bug_032076, Bug_044106, Bug_079398, Bug_092108, Bug_097608, Bug_098740, Bug_126104, Bug_127562, Bug_132510, Bug_160251, Bug_165892, Bug_226264, Bug_231301, Bug_265810, ChangeValidationTest, CharsetTest, ConcurrencyPerformanceTest, ConcurrencyTest, ContentDescriptionManagerTest, ContentDescriptionPerformanceTest, ExampleWorkspaceTest, HiddenResourceTest, HistoryBucketTest, HistoryStoreConversionTest, HistoryStorePerformanceTest, HistoryStoreTest, IFileTest, IFileTest, IFolderTest, IFolderTest, IPathVariableTest, IProjectDescriptionTest, IProjectTest, IResourceChangeEventTest, IResourceChangeListenerTest, IResourceDeltaTest, IResourceTest, IResourceTest, IResourceTest, ISynchronizerTest, IWorkspaceRootTest, IWorkspaceRunnableUseCaseTest, IWorkspaceTest, IWorkspaceTest, LinkedResourceTest, LocalHistoryPerformanceTest, LocalStoreTest, MarkerPerformanceTest, MarkerSetTest, MarkerTest, ModelObjectReaderWriterTest, NatureTest, NLTest, NonLocalLinkedResourceTest, ObjectMapTest, OldCorePerformanceTest, PR_1GEAB3C_Test, PR_1GH2B0N_Test, PR_1GHOM0N_Test, ProjectOrderTest, ProjectPreferencesTest, PropertyConversionTest, PropertyManagerPerformanceTest, RefreshLocalPerformanceTest, RefreshProviderTest, ResourceAttributeTest, ResourceInfoTest, ResourceURLTest, SafeFileInputOutputStreamTest, SyncAliasTest, TeamPrivateMemberTest, WorkspaceConcurrencyTest, WorkspacePerformanceTest, WorkspacePreferencesTest, WorkspaceSessionTest, WorkspaceTest

public abstract class ResourceTest
extends CoreTest

Superclass for tests that use the Eclipse Platform workspace.


Field Summary
static IResourceChangeListener deltaListener
          delta change listener if requested
static java.lang.String PI_RESOURCES_TESTS
           
 
Fields inherited from class org.eclipse.core.tests.harness.CoreTest
PI_HARNESS
 
Constructor Summary
ResourceTest()
          Need a zero argument constructor to satisfy the test harness.
ResourceTest(java.lang.String name)
          Creates a new ResourceTest
 
Method Summary
 void assertDoesNotExistInFileSystem(IResource resource)
          Assert that the given resource does not exist in the local store.
 void assertDoesNotExistInFileSystem(IResource[] resources)
          Assert that each element of the resource array does not exist in the local store.
 void assertDoesNotExistInFileSystem(java.lang.String message, IResource resource)
          Assert that the given resource does not exist in the local store.
 void assertDoesNotExistInFileSystem(java.lang.String message, IResource[] resources)
          Assert that each element of the resource array does not exist in the local store.
 void assertDoesNotExistInWorkspace(IResource resource)
          Assert that the given resource does not exist in the workspace resource info tree.
 void assertDoesNotExistInWorkspace(IResource[] resources)
          Assert that each element of the resource array does not exist in the workspace resource info tree.
 void assertDoesNotExistInWorkspace(java.lang.String message, IResource resource)
          Assert that the given resource does not exist in the workspace resource info tree.
 void assertDoesNotExistInWorkspace(java.lang.String message, IResource[] resources)
          Assert that each element of the resource array does not exist in the workspace resource info tree.
 void assertExistsInFileSystem(IResource resource)
          Assert whether or not the given resource exists in the local store.
 void assertExistsInFileSystem(IResource[] resources)
          Assert that each element in the resource array exists in the local store.
 void assertExistsInFileSystem(java.lang.String message, IResource resource)
          Assert whether or not the given resource exists in the local store.
 void assertExistsInFileSystem(java.lang.String message, IResource[] resources)
          Assert that each element in the resource array exists in the local store.
 void assertExistsInWorkspace(IResource resource)
          Assert whether or not the given resource exists in the workspace resource info tree.
 void assertExistsInWorkspace(IResource[] resources)
          Assert that each element of the resource array exists in the workspace resource info tree.
 void assertExistsInWorkspace(IResource[] resources, boolean phantom)
          Assert that each element of the resource array exists in the workspace resource info tree.
 void assertExistsInWorkspace(IResource resource, boolean phantom)
          Assert whether or not the given resource exists in the workspace resource info tree.
 void assertExistsInWorkspace(java.lang.String message, IResource resource)
          Assert whether or not the given resource exists in the workspace resource info tree.
 void assertExistsInWorkspace(java.lang.String message, IResource[] resources)
          Assert that each element of the resource array exists in the workspace resource info tree.
 void assertExistsInWorkspace(java.lang.String message, IResource[] resources, boolean phantom)
          Assert that each element of the resource array exists in the workspace resource info tree.
 void assertExistsInWorkspace(java.lang.String message, IResource resource, boolean phantom)
          Assert whether or not the given resource exists in the workspace resource info tree.
 IResource[] buildResources()
          Return a collection of resources the hierarchy defined by defineHeirarchy().
 IResource[] buildResources(IContainer root, java.lang.String[] hierarchy)
          Return a collection of resources for the given hierarchy at the given root.
 boolean compareContent(java.io.InputStream a, java.io.InputStream b)
          Returns a boolean value indicating whether or not the contents of the given streams are considered to be equal.
 void createFileInFileSystem(org.eclipse.core.filesystem.IFileStore file)
          Create the given file in the local store.
 void createFileInFileSystem(org.eclipse.core.filesystem.IFileStore file, java.io.InputStream contents)
          Create the given file in the local store.
 void createFileInFileSystem(org.eclipse.core.runtime.IPath path)
          Create the given file in the file system.
 void createFileInFileSystem(org.eclipse.core.runtime.IPath path, java.io.InputStream contents)
          Create the given file in the file system.
 IResource[] createHierarchy()
           
 java.lang.String[] defineHierarchy()
          Returns a collection of string paths describing the standard resource hierarchy for this test.
 void ensureDoesNotExistInFileSystem(IResource resource)
          Delete the given resource from the local store.
 void ensureDoesNotExistInFileSystem(IResource[] resources)
          Delete the resources in the array from the local store.
 void ensureDoesNotExistInWorkspace(IResource resource)
          Delete the given resource from the workspace resource tree.
 void ensureDoesNotExistInWorkspace(IResource[] resources)
          Delete each element of the resource array from the workspace resource info tree.
 void ensureExistsInFileSystem(IFile file)
          Create the given file in the local store.
 void ensureExistsInFileSystem(IResource resource)
          Create the given folder in the local store.
 void ensureExistsInFileSystem(IResource[] resources)
          Create the each resource of the array in the local store.
 void ensureExistsInWorkspace(IFile resource, java.io.InputStream contents)
          Create the given file in the workspace resource info tree.
 void ensureExistsInWorkspace(IFile resource, java.lang.String contents)
          Create the given file in the workspace resource info tree.
 void ensureExistsInWorkspace(IResource[] resources, boolean local)
          Create each element of the resource array in the workspace resource info tree.
 void ensureExistsInWorkspace(IResource resource, boolean local)
          Create the given resource in the workspace resource info tree.
 void ensureOutOfSync(IResource resource)
          Modifies the resource in the file system so that it is out of sync with the workspace.
 java.lang.String getUniqueString()
           
static IWorkspace getWorkspace()
           
 
Methods inherited from class org.eclipse.core.tests.harness.CoreTest
createFileInFileSystem, debug, fail, getContents, getContents, getMonitor, getRandomContents, getRandomLocation, getRandomString, getTempDir, log, log, transferData, transferDataWithoutClose
 
Methods inherited from class junit.framework.TestCase
countTestCases, getName, run, run, runBare, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

deltaListener

public static IResourceChangeListener deltaListener
delta change listener if requested


PI_RESOURCES_TESTS

public static final java.lang.String PI_RESOURCES_TESTS
See Also:
Constant Field Values
Constructor Detail

ResourceTest

public ResourceTest()
Need a zero argument constructor to satisfy the test harness. This constructor should not do any real work nor should it be called by user code.


ResourceTest

public ResourceTest(java.lang.String name)
Creates a new ResourceTest

Parameters:
name - java.lang.String
Method Detail

getWorkspace

public static IWorkspace getWorkspace()

assertDoesNotExistInFileSystem

public void assertDoesNotExistInFileSystem(IResource resource)
Assert that the given resource does not exist in the local store.


assertDoesNotExistInFileSystem

public void assertDoesNotExistInFileSystem(IResource[] resources)
Assert that each element of the resource array does not exist in the local store.


assertDoesNotExistInFileSystem

public void assertDoesNotExistInFileSystem(java.lang.String message,
                                           IResource resource)
Assert that the given resource does not exist in the local store.


assertDoesNotExistInFileSystem

public void assertDoesNotExistInFileSystem(java.lang.String message,
                                           IResource[] resources)
Assert that each element of the resource array does not exist in the local store.


assertDoesNotExistInWorkspace

public void assertDoesNotExistInWorkspace(IResource resource)
Assert that the given resource does not exist in the workspace resource info tree.


assertDoesNotExistInWorkspace

public void assertDoesNotExistInWorkspace(IResource[] resources)
Assert that each element of the resource array does not exist in the workspace resource info tree.


assertDoesNotExistInWorkspace

public void assertDoesNotExistInWorkspace(java.lang.String message,
                                          IResource resource)
Assert that the given resource does not exist in the workspace resource info tree.


assertDoesNotExistInWorkspace

public void assertDoesNotExistInWorkspace(java.lang.String message,
                                          IResource[] resources)
Assert that each element of the resource array does not exist in the workspace resource info tree.


assertExistsInFileSystem

public void assertExistsInFileSystem(IResource resource)
Assert whether or not the given resource exists in the local store. Use the resource manager to ensure that we have a correct Path -> File mapping.


assertExistsInFileSystem

public void assertExistsInFileSystem(IResource[] resources)
Assert that each element in the resource array exists in the local store.


assertExistsInFileSystem

public void assertExistsInFileSystem(java.lang.String message,
                                     IResource resource)
Assert whether or not the given resource exists in the local store. Use the resource manager to ensure that we have a correct Path -> File mapping.


assertExistsInFileSystem

public void assertExistsInFileSystem(java.lang.String message,
                                     IResource[] resources)
Assert that each element in the resource array exists in the local store.


assertExistsInWorkspace

public void assertExistsInWorkspace(IResource resource)
Assert whether or not the given resource exists in the workspace resource info tree.


assertExistsInWorkspace

public void assertExistsInWorkspace(IResource resource,
                                    boolean phantom)
Assert whether or not the given resource exists in the workspace resource info tree.


assertExistsInWorkspace

public void assertExistsInWorkspace(IResource[] resources)
Assert that each element of the resource array exists in the workspace resource info tree.


assertExistsInWorkspace

public void assertExistsInWorkspace(IResource[] resources,
                                    boolean phantom)
Assert that each element of the resource array exists in the workspace resource info tree.


assertExistsInWorkspace

public void assertExistsInWorkspace(java.lang.String message,
                                    IResource resource)
Assert whether or not the given resource exists in the workspace resource info tree.


assertExistsInWorkspace

public void assertExistsInWorkspace(java.lang.String message,
                                    IResource resource,
                                    boolean phantom)
Assert whether or not the given resource exists in the workspace resource info tree.


assertExistsInWorkspace

public void assertExistsInWorkspace(java.lang.String message,
                                    IResource[] resources)
Assert that each element of the resource array exists in the workspace resource info tree.


assertExistsInWorkspace

public void assertExistsInWorkspace(java.lang.String message,
                                    IResource[] resources,
                                    boolean phantom)
Assert that each element of the resource array exists in the workspace resource info tree.


buildResources

public IResource[] buildResources()
Return a collection of resources the hierarchy defined by defineHeirarchy().


buildResources

public IResource[] buildResources(IContainer root,
                                  java.lang.String[] hierarchy)
Return a collection of resources for the given hierarchy at the given root.


compareContent

public boolean compareContent(java.io.InputStream a,
                              java.io.InputStream b)
Returns a boolean value indicating whether or not the contents of the given streams are considered to be equal. Closes both input streams.


createFileInFileSystem

public void createFileInFileSystem(org.eclipse.core.filesystem.IFileStore file)
Create the given file in the local store.


createFileInFileSystem

public void createFileInFileSystem(org.eclipse.core.filesystem.IFileStore file,
                                   java.io.InputStream contents)
Create the given file in the local store.


createFileInFileSystem

public void createFileInFileSystem(org.eclipse.core.runtime.IPath path)
Create the given file in the file system.


createFileInFileSystem

public void createFileInFileSystem(org.eclipse.core.runtime.IPath path,
                                   java.io.InputStream contents)
Create the given file in the file system.


createHierarchy

public IResource[] createHierarchy()

defineHierarchy

public java.lang.String[] defineHierarchy()
Returns a collection of string paths describing the standard resource hierarchy for this test. In the string forms, folders are represented as having trailing separators ('/'). All other resources are files. It is generally assumed that this hierarchy will be inserted under some project structure. For example,
    return new String[] {"/", "/1/", "/1/1", "/1/2", "/1/3", "/2/", "/2/1"};
 


ensureDoesNotExistInFileSystem

public void ensureDoesNotExistInFileSystem(IResource resource)
Delete the given resource from the local store. Use the resource manager to ensure that we have a correct Path -> File mapping.


ensureDoesNotExistInFileSystem

public void ensureDoesNotExistInFileSystem(IResource[] resources)
Delete the resources in the array from the local store.


ensureDoesNotExistInWorkspace

public void ensureDoesNotExistInWorkspace(IResource resource)
Delete the given resource from the workspace resource tree.


ensureDoesNotExistInWorkspace

public void ensureDoesNotExistInWorkspace(IResource[] resources)
Delete each element of the resource array from the workspace resource info tree.


ensureExistsInFileSystem

public void ensureExistsInFileSystem(IFile file)
Create the given file in the local store. Use the resource manager to ensure that we have a correct Path -> File mapping.


ensureExistsInFileSystem

public void ensureExistsInFileSystem(IResource resource)
Create the given folder in the local store. Use the resource manager to ensure that we have a correct Path -> File mapping.


ensureExistsInFileSystem

public void ensureExistsInFileSystem(IResource[] resources)
Create the each resource of the array in the local store.


ensureExistsInWorkspace

public void ensureExistsInWorkspace(IFile resource,
                                    java.io.InputStream contents)
Create the given file in the workspace resource info tree.


ensureExistsInWorkspace

public void ensureExistsInWorkspace(IFile resource,
                                    java.lang.String contents)
Create the given file in the workspace resource info tree.


ensureExistsInWorkspace

public void ensureExistsInWorkspace(IResource resource,
                                    boolean local)
Create the given resource in the workspace resource info tree.


ensureExistsInWorkspace

public void ensureExistsInWorkspace(IResource[] resources,
                                    boolean local)
Create each element of the resource array in the workspace resource info tree.


ensureOutOfSync

public void ensureOutOfSync(IResource resource)
Modifies the resource in the file system so that it is out of sync with the workspace.


getUniqueString

public java.lang.String getUniqueString()
Overrides:
getUniqueString in class CoreTest