Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.eclipse.core.tests.resources.ResourceTestUtil.createInputStream;
import static org.eclipse.core.tests.resources.ResourceTestUtil.createUniqueString;
import static org.eclipse.core.tests.resources.ResourceTestUtil.ensureOutOfSync;
import static org.eclipse.core.tests.resources.ResourceTestUtil.isLocal;
import static org.eclipse.core.tests.resources.ResourceTestUtil.removeFromFileSystem;
import static org.eclipse.core.tests.resources.ResourceTestUtil.removeFromWorkspace;
import static org.eclipse.core.tests.resources.ResourceTestUtil.waitForRefresh;
Expand Down Expand Up @@ -147,7 +148,7 @@ public void testCreateFile() throws Exception {
/* create file with flag false */
file.create(createInputStream(originalContent), false, null);
assertTrue(file.exists());
assertTrue(file.isLocal(IResource.DEPTH_ZERO));
assertTrue(isLocal(file, IResource.DEPTH_ZERO));
assertEquals(file.getStore().fetchInfo().getLastModified(), file.getResourceInfo(false, false).getLocalSyncInfo());
try (InputStream readFile = getLocalManager().read(file, true, null)) {
assertThat(readFile).hasContent(originalContent);
Expand Down Expand Up @@ -187,6 +188,8 @@ public void testFileFor() {
assertNull(testFile);
}

// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void testIsLocal() throws CoreException {
// create resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.eclipse.core.tests.resources.ResourceTestUtil.createInWorkspace;
import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor;
import static org.eclipse.core.tests.resources.ResourceTestUtil.ensureOutOfSync;
import static org.eclipse.core.tests.resources.ResourceTestUtil.isLocal;
import static org.eclipse.core.tests.resources.ResourceTestUtil.removeFromFileSystem;
import static org.eclipse.core.tests.resources.ResourceTestUtil.removeFromWorkspace;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -231,7 +232,7 @@ public void testRefreshFolder() throws Throwable {
};
workspace.run(operation, null);
assertTrue(file.exists());
assertTrue(file.isLocal(IResource.DEPTH_ZERO));
assertTrue(isLocal(file, IResource.DEPTH_ZERO));
project.refreshLocal(IResource.DEPTH_INFINITE, null);
assertFalse(file.exists());
removeFromWorkspace(file);
Expand All @@ -252,15 +253,15 @@ public void testRefreshFolder() throws Throwable {
file = folder.getFile("file");
createInFileSystem(file);
assertTrue(folder.exists());
assertTrue(folder.isLocal(IResource.DEPTH_ZERO));
assertTrue(isLocal(folder, IResource.DEPTH_ZERO));
assertFalse(file.exists());
folder.refreshLocal(IResource.DEPTH_ZERO, null);
assertTrue(folder.exists());
assertTrue(folder.isLocal(IResource.DEPTH_ZERO));
assertTrue(isLocal(folder, IResource.DEPTH_ZERO));
assertFalse(file.exists());
folder.refreshLocal(IResource.DEPTH_ONE, null);
assertTrue(folder.exists());
assertTrue(folder.isLocal(IResource.DEPTH_ZERO));
assertTrue(isLocal(folder, IResource.DEPTH_ZERO));
assertTrue(file.exists());
removeFromWorkspace(folder);
removeFromFileSystem(folder);
Expand All @@ -270,7 +271,7 @@ public void testRefreshFolder() throws Throwable {
IFileStore fileStore = ((Resource) file).getStore();
createInWorkspace(file);
assertTrue(file.exists());
assertTrue(file.isLocal(IResource.DEPTH_ZERO));
assertTrue(isLocal(file, IResource.DEPTH_ZERO));
assertEquals(fileStore.fetchInfo().getLastModified(),
((Resource) file).getResourceInfo(false, false).getLocalSyncInfo());
ensureOutOfSync(file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void testChangingBuildConfigurations() throws CoreException {
public void testMixedProjectAndBuildConfigRefs() throws CoreException {
// Set project variant references
IProjectDescription desc = project0.getDescription();
desc.setDynamicReferences(new IProject[] {project1, project3});
setDynamicReferences(desc, new IProject[] { project1, project3 });
project0.setDescription(desc, createTestMonitor());

// Check getters
Expand Down Expand Up @@ -192,22 +192,22 @@ public void testSetAndGetProjectReferences() throws CoreException {
// Set project references
IProjectDescription desc = project0.getDescription();
desc.setReferencedProjects(new IProject[] {project3, project1});
desc.setDynamicReferences(new IProject[] {project1, project2});
setDynamicReferences(desc, new IProject[] { project1, project2 });
project0.setDescription(desc, createTestMonitor());

desc = project1.getDescription();
desc.setReferencedProjects(new IProject[] {project0});
desc.setDynamicReferences(new IProject[] {});
setDynamicReferences(desc, new IProject[] {});
project1.setDescription(desc, createTestMonitor());

desc = project2.getDescription();
desc.setReferencedProjects(new IProject[] {});
desc.setDynamicReferences(new IProject[] {});
setDynamicReferences(desc, new IProject[] {});
project2.setDescription(desc, createTestMonitor());

desc = project3.getDescription();
desc.setReferencedProjects(new IProject[] {});
desc.setDynamicReferences(new IProject[] {project0});
setDynamicReferences(desc, new IProject[] { project0 });
project3.setDescription(desc, createTestMonitor());

// Test getters
Expand All @@ -222,14 +222,20 @@ public void testSetAndGetProjectReferences() throws CoreException {
project1v0, project2v0);
}

// Suppress warning as we explicitly test deprecated API
@SuppressWarnings("deprecation")
private void setDynamicReferences(IProjectDescription description, IProject[] projects) {
description.setDynamicReferences(projects);
}

@Test
public void testSetAndGetProjectConfigReferences() throws CoreException {
// Set project variant references
IProjectDescription desc = project0.getDescription();
// 1 static reference
desc.setReferencedProjects(new IProject[] {project1});
// 1 dynamic project-level reference
desc.setDynamicReferences(new IProject[] {project3});
setDynamicReferences(desc, new IProject[] { project3 });
// config level references
desc.setBuildConfigReferences(bc0, new IBuildConfiguration[] {project2v0, project1v0});
desc.setBuildConfigReferences(bc1, new IBuildConfiguration[] {project2v0});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,8 @@ public void test328464() throws CoreException {
/**
* Regression test for bug 343914
*/
// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void test343914() throws CoreException {
String subProjectName = "subProject";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ public void testDirtyBuildSpec() throws CoreException {
assertTrue(modificationStamp != projectDescription.getModificationStamp());
}

// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void testDynamicProjectReferences() throws CoreException {
IProject target1 = getWorkspace().getRoot().getProject("target1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1990,6 +1990,8 @@ public void testProjectDeletionOpenUserDefinedOutOfSync() throws Exception {
/**
* Tests API on IProjectDescription
*/
// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void testProjectDescriptionDynamic() {
IProjectDescription desc = getWorkspace().newProjectDescription("foo");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,8 @@ public void testProjectDescriptionComment() throws CoreException {
assertDelta();
}

// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void testProjectDescriptionDynamicRefs() throws CoreException {
/* change file1's contents */
Expand Down Expand Up @@ -1523,6 +1525,8 @@ public void testReplaceFolderWithFolder() throws CoreException {
assertDelta();
}

// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void testSetLocal() throws CoreException {
verifier.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,8 @@ public void testDerived() throws CoreException {
* Performs black box testing of the following methods: isDerived() and
* setDerived(boolean)
*/
// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void testDeprecatedDerived() throws CoreException {
IWorkspaceRoot root = getWorkspace().getRoot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public class IWorkspaceRootTest {
/**
* Tests findFilesForLocation when non-canonical paths are used (bug 155101).
*/
// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void testFindFilesNonCanonicalPath() throws Exception {
assumeTrue("only relevant on Windows", OS.isWindows());
Expand Down Expand Up @@ -111,6 +113,8 @@ public void testFindContainersForLocationOnWrappedFileSystem() throws Exception
/**
* Tests the API method findContainersForLocation.
*/
// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
private void testFindContainersForLocation(IProject p1, IProject p2) throws Exception {
//should find the workspace root
IWorkspaceRoot root = getWorkspace().getRoot();
Expand Down Expand Up @@ -185,6 +189,8 @@ public void testFindFilesForLocation() throws CoreException {
/**
* Tests the API method findFilesForLocation.
*/
// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
private void testFindFilesForLocation(IProject project) throws CoreException {
//should not find the workspace root
IWorkspaceRoot root = getWorkspace().getRoot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static org.eclipse.core.tests.resources.ResourceTestUtil.createRandomContentsStream;
import static org.eclipse.core.tests.resources.ResourceTestUtil.createTestMonitor;
import static org.eclipse.core.tests.resources.ResourceTestUtil.createUniqueString;
import static org.eclipse.core.tests.resources.ResourceTestUtil.isLocal;
import static org.eclipse.core.tests.resources.ResourceTestUtil.readStringInFileSystem;
import static org.eclipse.core.tests.resources.ResourceTestUtil.removeFromFileSystem;
import static org.eclipse.core.tests.resources.ResourceTestUtil.removeFromWorkspace;
Expand Down Expand Up @@ -710,7 +711,7 @@ public void testCreateProjectWithDeepLinks() throws CoreException {
project.open(IResource.BACKGROUND_REFRESH, createTestMonitor());
assertTrue(folder.exists());
assertTrue(parent.exists());
assertTrue(parent.isLocal(IResource.DEPTH_INFINITE));
assertTrue(isLocal(parent, IResource.DEPTH_INFINITE));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,5 +767,10 @@ public static IFileStore getFileStore(Path path) throws IOException {
IPath canonicalIPath = wrapInCanonicalIPath(path);
return EFS.getLocalFileSystem().getStore(canonicalIPath);
}

@SuppressWarnings("deprecation")
public static boolean isLocal(IResource resource, int depth) {
return resource.isLocal(depth);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
* Tests how changes in the underlying preference store may affect the path
* variable manager.
*/
// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@ExtendWith(WorkspaceResetExtension.class)
public class Bug_027271 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public void testBug25662() throws CoreException {
/**
* Bug 11510 [resources] Non-local folders do not become local when directory is created.
*/
// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void testBug11510() throws Exception {
IWorkspaceRoot root = getWorkspace().getRoot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public void test_1G0XIMA() throws CoreException {
project.delete(true, createTestMonitor());
}

// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void test_1G5I6PV() throws CoreException {
/* common objects */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ public boolean visit(IResourceDelta aDelta) {
/**
* Calling isSynchronized on a non-local resource caused an internal error.
*/
// Explicitly tests deprecated API
@SuppressWarnings("deprecation")
@Test
public void testBug83777() throws CoreException {
IProject project = getWorkspace().getRoot().getProject("testBug83777");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace;
import static org.eclipse.core.tests.resources.ResourceTestUtil.createInputStream;
import static org.eclipse.core.tests.resources.ResourceTestUtil.isLocal;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.FILE;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.FOLDER;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.PROJECT;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.Q_NAME_SESSION;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.STRING_VALUE;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.commonFailureTestsForResource;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.isLocal;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
import static java.util.function.Predicate.not;
import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace;
import static org.eclipse.core.tests.resources.ResourceTestUtil.isLocal;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.FOLDER;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.PROJECT;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.Q_NAME_SESSION;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.STRING_VALUE;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.commonFailureTestsForResource;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.isLocal;
import static org.junit.jupiter.api.Assertions.assertThrows;

import org.eclipse.core.resources.IContainer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import static java.util.function.Predicate.not;
import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.core.resources.ResourcesPlugin.getWorkspace;
import static org.eclipse.core.tests.resources.ResourceTestUtil.isLocal;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.PROJECT;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.Q_NAME_SESSION;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.STRING_VALUE;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.commonFailureTestsForResource;
import static org.eclipse.core.tests.resources.usecase.IResourceTestUtil.isLocal;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.Hashtable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,4 @@ public static void commonFailureTestsForResource(IResource resource, boolean cre
assertThrows(CoreException.class, () -> resource.getSessionProperty(Q_NAME_SESSION));
assertThrows(CoreException.class, () -> resource.setSessionProperty(Q_NAME_SESSION, STRING_VALUE));
}

/**
* Wrapper for deprecated method {@link IResource#isLocal(int)} to reduce
* warnings.
*/
public static boolean isLocal(IResource resource, int depth) {
return resource.isLocal(depth);
}
}
Loading