diff options
Diffstat (limited to 'tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java')
-rw-r--r-- | tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java index 243c14938..70ecf59e2 100644 --- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java +++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java @@ -81,7 +81,7 @@ public class EclipseTest extends ResourceTest { /* * Get the resources for the given resource names */ - public IResource[] getResources(IContainer container, String[] hierarchy) throws CoreException { + public IResource[] getResources(IContainer container, String[] hierarchy) { IResource[] resources = new IResource[hierarchy.length]; for (int i=0;i<resources.length;i++) { resources[i] = container.findMember(hierarchy[i]); @@ -252,7 +252,7 @@ public class EclipseTest extends ResourceTest { protected boolean isAttemptHeadlessMerge() { return true; } - protected void showPreview(String title, IProgressMonitor monitor) { + protected void showPreview(IProgressMonitor monitor) { // Don't preview anything getContext().dispose(); } @@ -283,7 +283,7 @@ public class EclipseTest extends ResourceTest { protected boolean promptForOverwrite() { return true; } - protected void showPreview(String title, IProgressMonitor monitor) { + protected void showPreview(IProgressMonitor monitor) { // Don't show a preview. If the repalce failed, the sync tests will detect the failure getContext().dispose(); } @@ -303,12 +303,13 @@ public class EclipseTest extends ResourceTest { replace(mappings); else update(mappings, Command.NO_LOCAL_OPTIONS); + } else { + LocalOption[] options = Command.NO_LOCAL_OPTIONS; + if(ignoreLocalChanges) { + options = new LocalOption[] {Update.IGNORE_LOCAL_CHANGES}; + } + executeHeadless(new UpdateOperation(null, new IResource[] {project}, options, tag)); } - LocalOption[] options = Command.NO_LOCAL_OPTIONS; - if(ignoreLocalChanges) { - options = new LocalOption[] {Update.IGNORE_LOCAL_CHANGES}; - } - executeHeadless(new UpdateOperation(null, new IResource[] {project}, options, tag)); } public void commitProject(IProject project) throws TeamException, CoreException { @@ -567,7 +568,7 @@ public class EclipseTest extends ResourceTest { /* * Compare the files contents and sync information */ - protected void assertEquals(IPath parent, ICVSFile file1, ICVSFile file2, boolean includeTimestamps, boolean includeTags) throws CoreException, CVSException, IOException { + protected void assertEquals(IPath parent, ICVSFile file1, ICVSFile file2, boolean includeTimestamps, boolean includeTags) throws CoreException, CVSException { if (file1.getName().equals(".project")) return; // Getting the contents first is important as it will fetch the proper sync info if one of the files is a remote handle assertTrue("Contents of " + parent.append(file1.getName()) + " do not match", compareContent(getContents(file1), getContents(file2))); @@ -577,7 +578,7 @@ public class EclipseTest extends ResourceTest { /* * Compare sync info by comparing the entry line generated by the sync info */ - protected void assertEquals(IPath path, ResourceSyncInfo info1, ResourceSyncInfo info2, boolean includeTimestamp, boolean includeTag) throws CoreException, CVSException, IOException { + protected void assertEquals(IPath path, ResourceSyncInfo info1, ResourceSyncInfo info2, boolean includeTimestamp, boolean includeTag) { if (info1 == null || info2 == null) { if (info1 == info2) return; if (info1 == null) { @@ -610,7 +611,7 @@ public class EclipseTest extends ResourceTest { * Use the equals of folder sync info unless the tag is not included in which case we just * compare the root and repository */ - protected void assertEquals(IPath path, FolderSyncInfo info1, FolderSyncInfo info2, boolean includeTag) throws CoreException, CVSException, IOException { + protected void assertEquals(IPath path, FolderSyncInfo info1, FolderSyncInfo info2, boolean includeTag) { if (info1 == null && info2 == null) { return; } else if (info1 == null) { @@ -672,21 +673,21 @@ public class EclipseTest extends ResourceTest { assertEquals(getProvider(project), getProvider(checkoutCopy(project, tag)), true, false); } - protected void assertHasNoRemote(String prefix, IResource[] resources) throws TeamException { + protected void assertHasNoRemote(String prefix, IResource[] resources) { for (int i=0;i<resources.length;i++) assertHasNoRemote(prefix, resources[i]); } - protected void assertHasNoRemote(String prefix, IResource resource) throws TeamException { + protected void assertHasNoRemote(String prefix, IResource resource) { assertTrue(prefix + " resource should not have a remote", !CVSWorkspaceRoot.hasRemote(resource)); } - protected void assertHasRemote(String prefix, IResource[] resources) throws TeamException { + protected void assertHasRemote(String prefix, IResource[] resources) { for (int i=0;i<resources.length;i++) assertHasRemote(prefix, resources[i]); } - protected void assertHasRemote(String prefix, IResource resource) throws TeamException { + protected void assertHasRemote(String prefix, IResource resource) { assertTrue(prefix + " resource should have a remote", CVSWorkspaceRoot.hasRemote(resource)); } @@ -727,7 +728,7 @@ public class EclipseTest extends ResourceTest { resource.accept(new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { if (resource.getType() == IResource.FILE) { - assertEquals(isReadOnly, resource.isReadOnly()); + assertEquals(isReadOnly, resource.getResourceAttributes().isReadOnly()); } return recurse; } @@ -735,7 +736,7 @@ public class EclipseTest extends ResourceTest { } } - protected InputStream getContents(ICVSFile file) throws CVSException, IOException { + protected InputStream getContents(ICVSFile file) throws CVSException { if (file instanceof ICVSRemoteFile) return ((RemoteFile)file).getContents(DEFAULT_MONITOR); else @@ -745,7 +746,7 @@ public class EclipseTest extends ResourceTest { /* * Get the CVS Resource for the given resource */ - protected ICVSResource getCVSResource(IResource resource) throws CVSException { + protected ICVSResource getCVSResource(IResource resource) { return CVSWorkspaceRoot.getCVSResourceFor(resource); } @@ -758,7 +759,7 @@ public class EclipseTest extends ResourceTest { assertExistsInFileSystem(target); return target; } - protected CVSTeamProvider getProvider(IResource resource) throws TeamException { + protected CVSTeamProvider getProvider(IResource resource) { return (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject()); } protected static InputStream getRandomContents(int sizeAtLeast) { @@ -1256,8 +1257,10 @@ public class EclipseTest extends ResourceTest { try { resource.accept(new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { - if (resource.exists() && resource.isReadOnly()) { - resource.setReadOnly(false); + ResourceAttributes attrs = resource.getResourceAttributes(); + if (resource.exists() && attrs.isReadOnly()) { + attrs.setReadOnly(false); + resource.setResourceAttributes(attrs); } return true; } |