diff --git a/resources/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager1Test.java b/resources/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager1Test.java index fec1d5fcc55..297f4360160 100644 --- a/resources/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager1Test.java +++ b/resources/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager1Test.java @@ -25,6 +25,8 @@ import org.eclipse.core.tests.resources.saveparticipant3.SaveParticipant3Plugin; import org.osgi.framework.Bundle; import org.osgi.framework.BundleException; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; /** * This class needs to be used with SaveManager2Test. Basically this diff --git a/resources/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager2Test.java b/resources/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager2Test.java index 2e7cadcae05..29862157dd3 100644 --- a/resources/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager2Test.java +++ b/resources/tests/org.eclipse.core.tests.resources.saveparticipant/src/org/eclipse/core/tests/resources/saveparticipant/SaveManager2Test.java @@ -29,6 +29,9 @@ import junit.framework.Test; import junit.framework.TestSuite; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; /** * @see SaveManager1Test diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java index b97e62cbcb8..92aa0c38e62 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/alias/BasicAliasTest.java @@ -14,6 +14,9 @@ *******************************************************************************/ package org.eclipse.core.tests.internal.alias; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertThrows; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/LocalSyncTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/LocalSyncTest.java index 34afbc292e8..7e3673851b4 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/LocalSyncTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/LocalSyncTest.java @@ -13,6 +13,10 @@ *******************************************************************************/ package org.eclipse.core.tests.internal.localstore; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import org.eclipse.core.internal.resources.ICoreConstants; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/MoveTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/MoveTest.java index 63570336504..39a851f6815 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/MoveTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/MoveTest.java @@ -13,6 +13,10 @@ *******************************************************************************/ package org.eclipse.core.tests.internal.localstore; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import org.eclipse.core.internal.resources.File; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeValidationTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeValidationTest.java index 2262dc99366..406616faaf9 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeValidationTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/ChangeValidationTest.java @@ -14,6 +14,8 @@ *******************************************************************************/ package org.eclipse.core.tests.internal.mapping; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import java.util.ArrayList; import java.util.List; import org.eclipse.core.resources.IFile; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/TestProjectDeletion.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/TestProjectDeletion.java index 1378121a5d5..85bfa096003 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/TestProjectDeletion.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/mapping/TestProjectDeletion.java @@ -13,7 +13,11 @@ *******************************************************************************/ package org.eclipse.core.tests.internal.mapping; -import org.eclipse.core.resources.*; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; import org.eclipse.core.resources.mapping.ResourceChangeValidator; import org.eclipse.core.tests.resources.ResourceTest; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/CharsetTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/CharsetTest.java index 80a7f10727e..e8b783b1766 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/CharsetTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/CharsetTest.java @@ -15,6 +15,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import java.io.ByteArrayInputStream; @@ -187,7 +189,7 @@ public void _testBug67606() throws CoreException { assertEquals("1.0", "BAR", file.getCharset()); file.move(project.getFullPath().append("file2.txt"), IResource.NONE, monitor); IFile file2 = project.getFile("file2.txt"); - assertExistsInWorkspace(file2, false); + assertExistsInWorkspace(file2); assertEquals("2.0", "BAR", file.getCharset()); }, null); } finally { @@ -208,7 +210,7 @@ public void testCharsetMoveOnFileMove() throws CoreException { assertEquals("Setting up file's explicit charset was successful", "BAR", file.getCharset()); file.move(project.getFullPath().append("file2.txt"), IResource.NONE, getMonitor()); IFile file2 = project.getFile("file2.txt"); - assertExistsInWorkspace(file2, false); + assertExistsInWorkspace(file2); assertEquals("The file's charset was correctly copied while coying the file", "BAR", file2.getCharset()); } finally { ensureDoesNotExistInWorkspace(project); diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/HiddenResourceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/HiddenResourceTest.java index 16d823f966b..5fdedbf34f9 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/HiddenResourceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/HiddenResourceTest.java @@ -13,9 +13,20 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; -import org.eclipse.core.resources.*; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceVisitor; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.runtime.CoreException; public class HiddenResourceTest extends ResourceTest { diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFileTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFileTest.java index 99911c8a7ca..31a81d24e2d 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFileTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFileTest.java @@ -15,6 +15,10 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import java.io.ByteArrayInputStream; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFolderTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFolderTest.java index c15abd36dff..11825b16f19 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFolderTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IFolderTest.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import org.eclipse.core.resources.IFile; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java index 6955ae80df5..3d32ef48b40 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IProjectTest.java @@ -17,6 +17,8 @@ import static org.eclipse.core.tests.resources.ResourceTestPluginConstants.NATURE_EARTH; import static org.eclipse.core.tests.resources.ResourceTestPluginConstants.NATURE_MISSING; import static org.eclipse.core.tests.resources.ResourceTestPluginConstants.NATURE_SIMPLE; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import java.io.ByteArrayInputStream; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceChangeListenerTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceChangeListenerTest.java index ff50adc4ef9..0ad2dbf8955 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceChangeListenerTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceChangeListenerTest.java @@ -15,6 +15,7 @@ package org.eclipse.core.tests.resources; import static org.eclipse.core.tests.resources.ResourceTestPluginConstants.NATURE_SIMPLE; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java index 595a50b5eba..65ad43b53ea 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IResourceTest.java @@ -14,6 +14,10 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.empty; import static org.hamcrest.Matchers.is; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IWorkspaceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IWorkspaceTest.java index 42df72926b6..73ef7b45693 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IWorkspaceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/IWorkspaceTest.java @@ -27,6 +27,9 @@ import static org.eclipse.core.tests.resources.ResourceTestPluginConstants.SET_STATE; import static org.eclipse.core.tests.resources.ResourceTestPluginConstants.getInvalidNatureSets; import static org.eclipse.core.tests.resources.ResourceTestPluginConstants.getValidNatureSets; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertThrows; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceSyncMoveAndCopyTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceSyncMoveAndCopyTest.java index 170ff69e245..7e918b99a93 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceSyncMoveAndCopyTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceSyncMoveAndCopyTest.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import java.io.ByteArrayInputStream; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceTest.java index 6a3a30130e0..630e5901394 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceTest.java @@ -15,6 +15,8 @@ package org.eclipse.core.tests.resources; import static org.eclipse.core.tests.resources.ResourceTestPluginConstants.NATURE_SIMPLE; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import java.io.BufferedInputStream; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceWithPathVariableTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceWithPathVariableTest.java index 3cb2274bbbf..b8d0cbcbb33 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceWithPathVariableTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/LinkedResourceWithPathVariableTest.java @@ -16,6 +16,11 @@ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import java.io.File; import java.io.IOException; import java.io.InputStream; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java index 4a93f602e43..c725e696d4c 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java @@ -33,7 +33,6 @@ import java.nio.file.attribute.FileTime; import java.util.HashSet; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Stream; import org.eclipse.core.filesystem.EFS; import org.eclipse.core.filesystem.IFileInfo; @@ -56,12 +55,9 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.tests.harness.CoreTest; import org.eclipse.core.tests.harness.FileSystemHelper; @@ -180,186 +176,6 @@ public final void after() throws Exception { tearDown(); } - /** - * Assert that the given resource does not exist in the local store. - */ - public void assertDoesNotExistInFileSystem(IResource resource) { - assertDoesNotExistInFileSystem("", resource); //$NON-NLS-1$ - } - - /** - * Assert that each element of the resource array does not exist in the - * local store. - */ - public void assertDoesNotExistInFileSystem(IResource[] resources) { - assertDoesNotExistInFileSystem("", resources); //$NON-NLS-1$ - } - - /** - * Assert that the given resource does not exist in the local store. - */ - public void assertDoesNotExistInFileSystem(String message, IResource resource) { - if (existsInFileSystem(resource)) { - String formatted = message == null ? "" : message + " "; - fail(formatted + resource.getFullPath() + " unexpectedly exists in the file system"); - } - } - - /** - * Assert that each element of the resource array does not exist in the - * local store. - */ - public void assertDoesNotExistInFileSystem(String message, IResource[] resources) { - for (IResource resource : resources) { - assertDoesNotExistInFileSystem(message, resource); - } - } - - /** - * Assert that the given resource does not exist in the workspace - * resource info tree. - */ - public void assertDoesNotExistInWorkspace(IResource resource) { - assertDoesNotExistInWorkspace("", resource); //$NON-NLS-1$ - } - - /** - * Assert that each element of the resource array does not exist - * in the workspace resource info tree. - */ - public void assertDoesNotExistInWorkspace(IResource[] resources) { - assertDoesNotExistInWorkspace("", resources); //$NON-NLS-1$ - } - - /** - * Assert that the given resource does not exist in the workspace - * resource info tree. - */ - public void assertDoesNotExistInWorkspace(String message, IResource resource) { - if (existsInWorkspace(resource, false)) { - String formatted = message == null ? "" : message + " "; - fail(formatted + resource.getFullPath().toString() + " unexpectedly exists in the workspace"); - } - } - - /** - * Assert that each element of the resource array does not exist - * in the workspace resource info tree. - */ - public void assertDoesNotExistInWorkspace(String message, IResource[] resources) { - for (IResource resource : resources) { - assertDoesNotExistInWorkspace(message, 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. - */ - public void assertExistsInFileSystem(IResource resource) { - assertExistsInFileSystem("", resource); //$NON-NLS-1$ - } - - /** - * Assert that each element in the resource array exists in the local store. - */ - public void assertExistsInFileSystem(IResource[] resources) { - assertExistsInFileSystem("", resources); //$NON-NLS-1$ - } - - /** - * 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. - */ - public void assertExistsInFileSystem(String message, IResource resource) { - if (!existsInFileSystem(resource)) { - String formatted = message == null ? "" : message + " "; - fail(formatted + resource.getFullPath() + " unexpectedly does not exist in the file system"); - } - } - - /** - * Assert that each element in the resource array exists in the local store. - */ - public void assertExistsInFileSystem(String message, IResource[] resources) { - for (IResource resource : resources) { - assertExistsInFileSystem(message, resource); - } - } - - /** - * Assert whether or not the given resource exists in the workspace - * resource info tree. - */ - public void assertExistsInWorkspace(IResource resource) { - assertExistsInWorkspace("", resource, false); //$NON-NLS-1$ - } - - /** - * Assert whether or not the given resource exists in the workspace - * resource info tree. - */ - public void assertExistsInWorkspace(IResource resource, boolean phantom) { - assertExistsInWorkspace("", resource, phantom); //$NON-NLS-1$ - } - - /** - * Assert that each element of the resource array exists in the - * workspace resource info tree. - */ - public void assertExistsInWorkspace(IResource[] resources) { - assertExistsInWorkspace("", resources, false); //$NON-NLS-1$ - } - - /** - * Assert that each element of the resource array exists in the - * workspace resource info tree. - */ - public void assertExistsInWorkspace(IResource[] resources, boolean phantom) { - assertExistsInWorkspace("", resources, phantom); //$NON-NLS-1$ - } - - /** - * Assert whether or not the given resource exists in the workspace - * resource info tree. - */ - public void assertExistsInWorkspace(String message, IResource resource) { - assertExistsInWorkspace(message, resource, false); - } - - /** - * Assert whether or not the given resource exists in the workspace - * resource info tree. - */ - public void assertExistsInWorkspace(String message, IResource resource, boolean phantom) { - if (!existsInWorkspace(resource, phantom)) { - String formatted = message == null ? "" : message + " "; - fail(formatted + resource.getFullPath().toString() + " unexpectedly does not exist in the workspace"); - } - } - - /** - * Assert that each element of the resource array exists in the - * workspace resource info tree. - */ - public void assertExistsInWorkspace(String message, IResource[] resources) { - for (IResource resource : resources) { - assertExistsInWorkspace(message, resource, false); - } - } - - /** - * Assert that each element of the resource array exists in the - * workspace resource info tree. - */ - public void assertExistsInWorkspace(String message, IResource[] resources, boolean phantom) { - for (IResource resource : resources) { - assertExistsInWorkspace(message, resource, phantom); - } - } - /** * Return a collection of resources the hierarchy defined by defineHeirarchy(). */ @@ -447,19 +263,6 @@ public boolean compareContent(InputStream a, InputStream b) { } } - private IPath computeDefaultLocation(IResource target) { - switch (target.getType()) { - case IResource.ROOT : - return Platform.getLocation(); - case IResource.PROJECT : - return Platform.getLocation().append(target.getFullPath()); - default : - IPath location = computeDefaultLocation(target.getProject()); - location = location.append(target.getFullPath().removeFirstSegments(1)); - return location; - } - } - protected void create(final IResource resource, boolean local) throws CoreException { if (resource == null || resource.exists()) { return; @@ -743,56 +546,6 @@ private long getLastModifiedTime(IPath fileLocation) { return fileInfo.getLastModified(); } - private boolean existsInFileSystem(IResource resource) { - IPath path = resource.getLocation(); - if (path == null) { - path = computeDefaultLocation(resource); - } - return path.toFile().exists(); - } - - boolean existsInWorkspace(IResource resource, boolean phantom) { - class CheckIfResourceExistsJob extends Job { - - private final AtomicBoolean resourceExists = new AtomicBoolean(false); - - public CheckIfResourceExistsJob() { - super("Test " + ResourceTest.this.getName() + " checking whether resource exists: " + resource); - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - if (monitor.isCanceled()) { - return Status.CANCEL_STATUS; - } - - IResource target = getWorkspace().getRoot().findMember(resource.getFullPath(), phantom); - boolean existsInWorkspace = target != null && target.getType() == resource.getType(); - resourceExists.set(existsInWorkspace); - - return Status.OK_STATUS; - } - - boolean resourceExists() { - return resourceExists.get(); - } - } - - IWorkspace workspace = getWorkspace(); - ISchedulingRule modifyWorkspaceRule = workspace.getRuleFactory().modifyRule(workspace.getRoot()); - - CheckIfResourceExistsJob checkIfResourceExistsJob = new CheckIfResourceExistsJob(); - checkIfResourceExistsJob.setRule(modifyWorkspaceRule); - checkIfResourceExistsJob.schedule(); - try { - checkIfResourceExistsJob.join(30_000, getMonitor()); - } catch (OperationCanceledException | InterruptedException e) { - throw new IllegalStateException("failed when joining resource-existence-checking job", e); - } - - return checkIfResourceExistsJob.resourceExists(); - } - protected String getLineSeparatorFromFile(IFile file) { if (file.exists()) { InputStream input = null; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java new file mode 100644 index 00000000000..0343fb66bf8 --- /dev/null +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTestUtil.java @@ -0,0 +1,244 @@ +/******************************************************************************* + * Copyright (c) 2023 Vector Informatik GmbH and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + *******************************************************************************/ +package org.eclipse.core.tests.resources; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.concurrent.atomic.AtomicBoolean; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.tests.harness.FussyProgressMonitor; + +/** + * Utilities for resource tests. + */ +public final class ResourceTestUtil { + private ResourceTestUtil() { + } + + public static IProgressMonitor getMonitor() { + return new FussyProgressMonitor(); + } + + /** + * Assert whether or not the given resource exists in the workspace resource + * info tree. + */ + public static void assertExistsInWorkspace(IResource resource) { + assertExistsInWorkspace("", resource); //$NON-NLS-1$ + } + + /** + * Assert that each element of the resource array exists in the workspace + * resource info tree. + */ + public static void assertExistsInWorkspace(IResource[] resources) { + assertExistsInWorkspace("", resources); + } + + /** + * Assert whether or not the given resource exists in the workspace resource + * info tree. + */ + public static void assertExistsInWorkspace(String message, IResource resource) { + String formatted = message == null || message.isEmpty() ? "" : message + " "; + assertTrue(formatted + resource.getFullPath() + " unexpectedly does not exist in the workspace", + existsInWorkspace(resource)); + } + + + /** + * Assert that each element of the resource array exists in the workspace + * resource info tree. + */ + public static void assertExistsInWorkspace(String message, IResource[] resources) { + for (IResource resource : resources) { + assertExistsInWorkspace(message, resource); + } + } + + private static boolean existsInWorkspace(IResource resource) { + class CheckIfResourceExistsJob extends Job { + private final AtomicBoolean resourceExists = new AtomicBoolean(false); + + public CheckIfResourceExistsJob() { + super("Checking whether resource exists: " + resource); + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + + IResource target = ResourceTest.getWorkspace().getRoot().findMember(resource.getFullPath(), false); + boolean existsInWorkspace = target != null && target.getType() == resource.getType(); + resourceExists.set(existsInWorkspace); + + return Status.OK_STATUS; + } + + boolean resourceExists() { + return resourceExists.get(); + } + } + + IWorkspace workspace = ResourceTest.getWorkspace(); + ISchedulingRule modifyWorkspaceRule = workspace.getRuleFactory().modifyRule(workspace.getRoot()); + + CheckIfResourceExistsJob checkIfResourceExistsJob = new CheckIfResourceExistsJob(); + checkIfResourceExistsJob.setRule(modifyWorkspaceRule); + checkIfResourceExistsJob.schedule(); + try { + checkIfResourceExistsJob.join(30_000, getMonitor()); + } catch (OperationCanceledException | InterruptedException e) { + throw new IllegalStateException("failed when joining resource-existence-checking job", e); + } + return checkIfResourceExistsJob.resourceExists(); + } + + /** + * Assert that the given resource does not exist in the workspace resource info + * tree. + */ + public static void assertDoesNotExistInWorkspace(IResource resource) { + assertDoesNotExistInWorkspace("", resource); //$NON-NLS-1$ + } + + /** + * Assert that each element of the resource array does not exist in the + * workspace resource info tree. + */ + public static void assertDoesNotExistInWorkspace(IResource[] resources) { + assertDoesNotExistInWorkspace("", resources); //$NON-NLS-1$ + } + + /** + * Assert that the given resource does not exist in the workspace resource info + * tree. + */ + public static void assertDoesNotExistInWorkspace(String message, IResource resource) { + String formatted = message == null || message.isEmpty() ? "" : message + " "; + assertFalse(formatted + resource.getFullPath() + " unexpectedly exists in the workspace", + existsInWorkspace(resource)); + } + + /** + * Assert that each element of the resource array does not exist in the + * workspace resource info tree. + */ + public static void assertDoesNotExistInWorkspace(String message, IResource[] resources) { + for (IResource resource : resources) { + assertDoesNotExistInWorkspace(message, 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. + */ + public static void assertExistsInFileSystem(IResource resource) { + assertExistsInFileSystem("", resource); //$NON-NLS-1$ + } + + + /** + * Assert that each element in the resource array exists in the local store. + */ + public static void assertExistsInFileSystem(IResource[] resources) { + assertExistsInFileSystem("", resources); //$NON-NLS-1$ + } + + /** + * 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. + */ + public static void assertExistsInFileSystem(String message, IResource resource) { + String formatted = message == null || message.isEmpty() ? "" : message + " "; + assertTrue(formatted + resource.getFullPath() + " unexpectedly does not exist in the file system", + existsInFileSystem(resource)); + } + + /** + * Assert that each element in the resource array exists in the local store. + */ + public static void assertExistsInFileSystem(String message, IResource[] resources) { + for (IResource resource : resources) { + assertExistsInFileSystem(message, resource); + } + } + + private static boolean existsInFileSystem(IResource resource) { + IPath path = resource.getLocation(); + if (path == null) { + path = computeDefaultLocation(resource); + } + return path.toFile().exists(); + } + + private static IPath computeDefaultLocation(IResource target) { + switch (target.getType()) { + case IResource.ROOT: + return Platform.getLocation(); + case IResource.PROJECT: + return Platform.getLocation().append(target.getFullPath()); + default: + IPath location = computeDefaultLocation(target.getProject()); + location = location.append(target.getFullPath().removeFirstSegments(1)); + return location; + } + } + + /** + * Assert that the given resource does not exist in the local store. + */ + public static void assertDoesNotExistInFileSystem(IResource resource) { + assertDoesNotExistInFileSystem("", resource); //$NON-NLS-1$ + } + + /** + * Assert that each element of the resource array does not exist in the + * local store. + */ + public static void assertDoesNotExistInFileSystem(IResource[] resources) { + assertDoesNotExistInFileSystem("", resources); //$NON-NLS-1$ + } + + /** + * Assert that the given resource does not exist in the local store. + */ + public static void assertDoesNotExistInFileSystem(String message, IResource resource) { + String formatted = message == null || message.isEmpty() ? "" : message + " "; + assertFalse(formatted + resource.getFullPath() + " unexpectedly exists in the file system", + existsInFileSystem(resource)); + } + + /** + * Assert that each element of the resource array does not exist in the local + * store. + */ + public static void assertDoesNotExistInFileSystem(String message, IResource[] resources) { + for (IResource resource : resources) { + assertDoesNotExistInFileSystem(message, resource); + } + } + +} diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/TeamPrivateMemberTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/TeamPrivateMemberTest.java index 759b8d32a5a..cf413af240d 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/TeamPrivateMemberTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/TeamPrivateMemberTest.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.arrayWithSize; import static org.hamcrest.Matchers.is; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/VirtualFolderTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/VirtualFolderTest.java index e12036520bd..b2e53eeab01 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/VirtualFolderTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/VirtualFolderTest.java @@ -15,6 +15,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import org.eclipse.core.filesystem.EFS; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/WorkspaceTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/WorkspaceTest.java index 2206374d5b4..19ba8fdc316 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/WorkspaceTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/WorkspaceTest.java @@ -15,6 +15,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertThrows; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_026294.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_026294.java index 4077c1cb0ce..635b9fb9fe9 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_026294.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_026294.java @@ -13,6 +13,10 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.regression; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; import static org.junit.Assert.assertThrows; import java.io.InputStream; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_029671.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_029671.java index 8ce2b997d02..044f583e62c 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_029671.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_029671.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.regression; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java index 4b30b71aeb2..10549b4b75e 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_044106.java @@ -13,6 +13,10 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.regression; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import java.io.IOException; import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.resources.IFile; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_079398.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_079398.java index 810726789ff..e4287e41e20 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_079398.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_079398.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.regression; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import org.eclipse.core.internal.localstore.IHistoryStore; import org.eclipse.core.internal.resources.Workspace; import org.eclipse.core.resources.IFile; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_226264.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_226264.java index d6d502bf9a1..8b0ca761b11 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_226264.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_226264.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.regression; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; + import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceChangeListener; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_233939.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_233939.java index 18ce35a1013..7998e14c483 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_233939.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_233939.java @@ -14,6 +14,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.regression; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import java.net.URI; import org.eclipse.core.filesystem.IFileStore; import org.eclipse.core.filesystem.URIUtil; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_264182.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_264182.java index ee24db80ded..e8a9128f4a0 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_264182.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_264182.java @@ -13,6 +13,7 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.regression; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; import static org.junit.Assert.assertThrows; import org.eclipse.core.filesystem.IFileStore; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_265810.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_265810.java index edfec73e78e..722f589ce23 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_265810.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_265810.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.regression; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/NLTest.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/NLTest.java index 566aee9e603..724aec3c9a2 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/NLTest.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/NLTest.java @@ -14,6 +14,9 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.regression; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import java.util.ArrayList; import java.util.List; import java.util.Locale; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug93473.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug93473.java index 794ff3798c5..6f774cc59ab 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug93473.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug93473.java @@ -14,6 +14,7 @@ package org.eclipse.core.tests.resources.session; import static org.eclipse.core.tests.resources.ResourceTestPluginConstants.PI_RESOURCES_TESTS; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; import junit.framework.Test; import org.eclipse.core.internal.resources.ContentDescriptionManager; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestMultiSnap.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestMultiSnap.java index a8ac3c10da0..87d97d578f1 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestMultiSnap.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestMultiSnap.java @@ -13,8 +13,13 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.session; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import junit.framework.Test; -import org.eclipse.core.resources.*; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.tests.resources.AutomatedResourceTests; import org.eclipse.core.tests.session.WorkspaceSessionTestSuite; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestSaveSnap.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestSaveSnap.java index 3700c4ec95e..7d06f3d71a4 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestSaveSnap.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestSaveSnap.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.session; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import java.io.ByteArrayInputStream; import junit.framework.Test; import org.eclipse.core.resources.IFile; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestSnapSaveSnap.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestSnapSaveSnap.java index 18c1a9b3aff..5f609200249 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestSnapSaveSnap.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestSnapSaveSnap.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.session; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import java.io.ByteArrayInputStream; import junit.framework.Test; import org.eclipse.core.resources.IFile; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot1Test.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot1Test.java index faaaa048b0a..dfbd0921122 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot1Test.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot1Test.java @@ -13,6 +13,9 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.usecase; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot2Test.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot2Test.java index 3228c39772f..ec84131f0d3 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot2Test.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot2Test.java @@ -14,6 +14,9 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.usecase; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot3Test.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot3Test.java index 1c22834fcc0..9b2d8deb053 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot3Test.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot3Test.java @@ -13,6 +13,9 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.usecase; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IResource; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot4Test.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot4Test.java index f61550bd966..3df848451bf 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot4Test.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot4Test.java @@ -14,6 +14,11 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.usecase; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot5Test.java b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot5Test.java index 9739bd41ab6..f6b74f21799 100644 --- a/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot5Test.java +++ b/resources/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/usecase/Snapshot5Test.java @@ -13,6 +13,11 @@ *******************************************************************************/ package org.eclipse.core.tests.resources.usecase; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertDoesNotExistInWorkspace; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInWorkspace; + import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; diff --git a/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java b/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java index 78e2dd6a2c7..72a4dd5ce4c 100644 --- a/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java +++ b/team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/WorkspaceTest.java @@ -13,11 +13,25 @@ *******************************************************************************/ package org.eclipse.compare.tests; -import java.io.*; -import java.util.*; +import static org.eclipse.core.tests.resources.ResourceTestUtil.assertExistsInFileSystem; -import org.eclipse.core.resources.*; -import org.eclipse.core.runtime.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; import org.eclipse.core.tests.resources.ResourceTest; import junit.framework.Test;