Skip to main content
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-02-25 20:34:58 +0000
committerJean Michel-Lemieux2004-02-25 20:34:58 +0000
commit4a1ca77df6f4238416a8715a8c35819611d5992a (patch)
tree03e4ed09e94442352cb8c3143df59d3b22725627 /tests
parenta650f9521c18cb3c840475358086bf5f4052a824 (diff)
downloadeclipse.platform.team-4a1ca77df6f4238416a8715a8c35819611d5992a.tar.gz
eclipse.platform.team-4a1ca77df6f4238416a8715a8c35819611d5992a.tar.xz
eclipse.platform.team-4a1ca77df6f4238416a8715a8c35819611d5992a.zip
SyncView API released to HEAD.
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java57
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/AllTeamSynchronizeTests.java (renamed from tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/AllTests.java)38
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java107
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java209
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java39
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java54
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java46
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00007.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00009.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00011.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00013.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00016.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00018.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00019.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00021.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00022.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00023.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00024.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00025.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00026.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00027.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00028.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00029.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00029a.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00030.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00030a.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00032.html2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00033.html11
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00034.html11
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00035.html11
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00036.html11
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00037.html11
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/html/00038.html11
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch32
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java25
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java70
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java37
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/AllTestsTeamSubscriber.java1
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSCompareSubscriberTest.java105
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java11
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java56
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java54
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java28
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java29
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/HeadlessCVSRunnableContext.java12
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java40
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java68
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ArgumentParser.java49
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/BenchmarkTestSetup.java55
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java465
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CaseEntry.java38
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CommandTests.java237
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DelimitedValuesWriter.java54
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DummyPromptCondition.java24
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/EmptyPerspective.java54
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/FakeSelectionProvider.java42
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/GroupEntry.java28
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ICriteria.java23
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ILogEntryVisitor.java19
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntry.java124
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntryContainer.java63
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogFormatterUIMain.java188
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestCase.java107
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestResult.java264
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestRunner.java38
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/MergeRunsVisitor.java76
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PerformanceTimer.java55
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVDiffVisitor.java102
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVSummaryVisitor.java82
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffMain.java154
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffVisitor.java90
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintSummaryMain.java122
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextDiffVisitor.java147
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextSummaryVisitor.java109
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Result.java39
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/RootEntry.java48
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SequenceGenerator.java63
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SyncTests.java112
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/TaskEntry.java106
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Util.java23
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Utils.java774
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Waiter.java35
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/WorkflowTests.java156
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/toc.xml12
90 files changed, 902 insertions, 4511 deletions
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java
index 3370456bb..35727acdb 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/core/TeamTest.java
@@ -10,32 +10,35 @@
*******************************************************************************/
package org.eclipse.team.tests.core;
-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 java.io.*;
+import java.util.*;
-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.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 junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.core.tests.harness.EclipseWorkspaceTest;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
public class TeamTest extends EclipseWorkspaceTest {
protected static IProgressMonitor DEFAULT_MONITOR = new NullProgressMonitor();
protected static final IProgressMonitor DEFAULT_PROGRESS_MONITOR = new NullProgressMonitor();
+ public static Test suite(Class c) {
+ String testName = System.getProperty("eclipse.team.testName");
+ if (testName == null) {
+ TestSuite suite = new TestSuite(c);
+ return suite;
+ } else {
+ try {
+ return (Test)c.getConstructor(new Class[] { String.class }).newInstance(new Object[] {testName});
+ } catch (Exception e) {
+ fail(e.getMessage());
+ // Above will throw so below is never actually reached
+ return null;
+ }
+ }
+ }
public TeamTest() {
super();
@@ -145,22 +148,6 @@ public class TeamTest extends EclipseWorkspaceTest {
}
}
- // Assert that the two containers have equal contents
- protected void assertEquals(IRemoteResource container1, IResource container2) throws CoreException, TeamException {
- if (container2.getType() == IResource.FILE) {
- // Ignore .project file
- if (container2.getName().equals(".project"))
- return;
- assertTrue(compareContent(container1.getContents(DEFAULT_MONITOR), ((IFile) container2).getContents()));
- } else {
- IRemoteResource[] remoteResources = container1.members(DEFAULT_MONITOR);
- IResource[] localResources = ((IFolder) container2).members();
- for (int i = 0; i < localResources.length; i++) {
- assertEquals(remoteResources[i], localResources[i]);
- }
- }
- }
-
public void appendText(IResource resource, String text, boolean prepend) throws CoreException, IOException {
IFile file = (IFile) resource;
InputStream in = file.getContents();
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/AllTests.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/AllTeamSynchronizeTests.java
index 8b11d77fc..24f9123be 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/AllTests.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/AllTeamSynchronizeTests.java
@@ -8,25 +8,35 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
+package org.eclipse.team.tests.ui.synchronize;
import junit.framework.Test;
import junit.framework.TestSuite;
-public class AllTests extends TestSuite {
- public static Test suite() {
- TestSuite suite = new TestSuite();
- suite.addTestSuite(SyncTests.class);
- suite.addTestSuite(WorkflowTests.class);
- //suite.addTestSuite(CommandTests.class);
- return new BenchmarkTestSetup(suite);
- }
-
- public AllTests(String name) {
+import org.eclipse.core.tests.harness.EclipseWorkspaceTest;
+
+public class AllTeamSynchronizeTests extends EclipseWorkspaceTest {
+
+ /**
+ * Constructor for CVSClientTest.
+ */
+ public AllTeamSynchronizeTests() {
+ super();
+ }
+
+ /**
+ * Constructor for CVSClientTest.
+ * @param name
+ */
+ public AllTeamSynchronizeTests(String name) {
super(name);
}
- public AllTests() {
- super();
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.addTest(TestDiffNodePresentationModel.suite());
+ suite.addTest(SyncInfoSetContentProviderTest.suite());
+ return suite;
}
}
+
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java
new file mode 100644
index 000000000..2d4d6421d
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/SyncInfoSetContentProviderTest.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.synchronize;
+
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.team.core.synchronize.SyncInfoTree;
+import org.eclipse.team.ui.synchronize.viewers.SynchronizeModelProvider;
+import org.eclipse.team.ui.synchronize.viewers.CompressedFoldersModelProvider;
+
+/**
+ * Tests for the SyncInfoSet content providers.
+ */
+public class SyncInfoSetContentProviderTest extends TestDiffNodePresentationModel {
+
+ /**
+ * Constructor for CVSProviderTest
+ */
+ public SyncInfoSetContentProviderTest() {
+ super();
+ }
+
+ /**
+ * Constructor for CVSProviderTest
+ */
+ public SyncInfoSetContentProviderTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return suite(SyncInfoSetContentProviderTest.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.tests.ui.synchronize.TestDiffNodePresentationModel#getDiffNodeController()
+ */
+ protected SynchronizeModelProvider getDiffNodeController(SyncInfoTree set) {
+ return new CompressedFoldersModelProvider(set);
+ }
+
+ private void assertFolderPresent(IFolder folder, List resources) {
+ // First, if the folder is out-of-sync, it should be visible
+ for (Iterator iter = resources.iterator(); iter.hasNext();) {
+ IResource resource = (IResource) iter.next();
+ if (resource.equals(folder)) {
+ // The folder should be present.
+ // Remove it since it has been verified
+ iter.remove();
+ return;
+ }
+ }
+ // If the folder contains a file in the list, it is also OK
+ for (Iterator iter = resources.iterator(); iter.hasNext();) {
+ IResource resource = (IResource) iter.next();
+ if (resource.getType() == IResource.FILE && resource.getParent().equals(folder)) {
+ // The compressed folder is valid since it contains an out-of-sync file
+ // However, the resource is left since it has not been verified (only it's parent)
+ return;
+ }
+ }
+ fail("Folder " + folder.getFullPath() + " should not be visible but is.");
+ }
+
+ private void assertFilePresent(IResource itemResource, List resources) {
+ for (Iterator iter = resources.iterator(); iter.hasNext();) {
+ IResource resource = (IResource) iter.next();
+ if (resource.equals(itemResource)) {
+ // The resource has been verified so it can be removed
+ iter.remove();
+ return;
+ }
+ }
+ fail("Resource " + itemResource.getFullPath() + " should not be visible but is.");
+ }
+
+ private void assertProjectPresent(IProject project, List resources) {
+// First, if the project is out-of-sync, it should be visible
+ for (Iterator iter = resources.iterator(); iter.hasNext();) {
+ IResource resource = (IResource) iter.next();
+ if (resource.equals(project)) {
+ // The folder should be present.
+ // Remove it since it has been verified
+ iter.remove();
+ return;
+ }
+ }
+ for (Iterator iter = resources.iterator(); iter.hasNext();) {
+ IResource resource = (IResource) iter.next();
+ if (resource.getProject().equals(project)) {
+ return;
+ }
+ }
+ fail("Project " + project.getName() + " should not be visible but is.");
+ }
+}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java
new file mode 100644
index 000000000..833849309
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestDiffNodePresentationModel.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.synchronize;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.tests.core.TeamTest;
+import org.eclipse.team.tests.ui.views.ContentProviderTestView;
+import org.eclipse.team.tests.ui.views.TestTreeViewer;
+import org.eclipse.team.ui.synchronize.viewers.*;
+
+
+public class TestDiffNodePresentationModel extends TeamTest {
+
+ private ContentProviderTestView view;
+ private SyncInfoTree set;
+ private TreeViewerAdvisor configuration;
+
+ public TestDiffNodePresentationModel() {
+ super();
+ }
+
+ public TestDiffNodePresentationModel(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return suite(TestDiffNodePresentationModel.class);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.set = new SyncInfoTree();
+ this.configuration = new TreeViewerAdvisor(set) {
+ protected SynchronizeModelProvider getDiffNodeController() {
+ return TestDiffNodePresentationModel.this.getDiffNodeController(set);
+ }
+ };
+ view = ContentProviderTestView.findViewInActivePage(null);
+ configuration.initializeViewer(view.getViewer());
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ set = null;
+ configuration.dispose();
+ super.tearDown();
+ }
+
+ protected SynchronizeModelProvider getDiffNodeController(SyncInfoTree set) {
+ return new HierarchicalModelProvider(set);
+ }
+
+ /*
+ * This method creates a project with the given resources, imports
+ * it to CVS and checks it out
+ */
+ protected IProject createProject(String prefix, String[] resources) throws CoreException {
+ IProject project = getUniqueTestProject(prefix);
+ buildResources(project, resources, true);
+ return project;
+ }
+
+ /*
+ * Create a test project using the currently running test case as the project name prefix
+ */
+ protected IProject createProject(String[] resources) throws CoreException {
+ return createProject(getName(), resources);
+ }
+
+ private void adjustSet(SyncInfoSet set, IProject project, String[] resourceStrings, int[] syncKind) throws TeamException {
+ IResource[] resources = buildResources(project, resourceStrings);
+ try {
+ set.beginInput();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ int kind = syncKind[i];
+ if (kind == SyncInfo.IN_SYNC) {
+ set.remove(resource);
+ } else {
+ SyncInfo newInfo = new TestSyncInfo(resource, kind);
+ set.add(newInfo);
+ }
+ }
+ } finally {
+ set.endInput(null);
+ }
+ }
+
+ /**
+ * Ensure that the resource
+ * @param resources
+ */
+ protected void assertProperVisibleItems() {
+ IResource[] resources = set.getResources();
+ List resourceList = new ArrayList();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ resourceList.add(resource);
+ }
+ TestTreeViewer viewer = view.getViewer();
+ Item[] items = viewer.getRootItems();
+ if (resources.length == 0) {
+ assertTrue("There are items visible when there should not be.", items.length == 0);
+ return;
+ }
+ // Test that all items in the tree are expected
+ for (int i = 0; i < items.length; i++) {
+ Item item = items[i];
+ assertThatAllOutOfSyncResourcesAreShown(item, resourceList);
+ }
+ // Test that all expected resources and their parents are present
+ assertTrue("The tree did not contain all expected resources: " + resourceList.toString(), resourceList.isEmpty());
+ }
+
+ /**
+ * Traverse every element shown in the view and ensure that every out-of-sync
+ * resource in the set is at least shown. This doesn't test the actual logical
+ * organization, but does ensure that all out-of-sync resources are shown only
+ * once.
+ */
+ protected void assertThatAllOutOfSyncResourcesAreShown(Item item, List outOfSyncResources) {
+ Object node = item.getData();
+ SyncInfo info = (SyncInfo)Utils.getAdapter(node, SyncInfo.class);
+ if(info != null) {
+ assertTrue("The tree contained an out-of-sync resource that wasn't in the set", outOfSyncResources.remove(info.getLocal()));
+ }
+ Item[] children = view.getViewer().getChildren(item);
+ for (int i = 0; i < children.length; i++) {
+ Item child = children[i];
+ assertThatAllOutOfSyncResourcesAreShown(child, outOfSyncResources);
+ }
+ }
+
+ public void testNestedFolder() throws CoreException {
+ IProject project = createProject(new String[]{"file.txt", "folder1/file2.txt", "folder1/folder2/file3.txt"});
+ adjustSet(set, project,
+ new String[]{"file.txt"},
+ new int[]{SyncInfo.OUTGOING | SyncInfo.CHANGE});
+ assertProperVisibleItems();
+ adjustSet(set, project,
+ new String[]{"folder1/file2.txt", "folder1/folder2/file3.txt"},
+ new int[]{SyncInfo.OUTGOING | SyncInfo.CHANGE, SyncInfo.OUTGOING | SyncInfo.CHANGE});
+ assertProperVisibleItems();
+ adjustSet(set, project,
+ new String[]{"folder1/file2.txt"},
+ new int[]{SyncInfo.IN_SYNC,});
+ assertProperVisibleItems();
+ }
+
+ public void testParentRemovalWithChildRemaining() throws CoreException {
+ IProject project = createProject(new String[]{"file.txt", "folder1/file2.txt", "folder1/folder2/file3.txt"});
+ adjustSet(set, project,
+ new String[]{"folder1/folder2/", "folder1/folder2/file3.txt"},
+ new int[]{SyncInfo.CONFLICTING | SyncInfo.CHANGE, SyncInfo.CONFLICTING | SyncInfo.CHANGE});
+ assertProperVisibleItems();
+
+ adjustSet(set, project,
+ new String[]{"folder1/folder2/", "folder1/folder2/file3.txt"},
+ new int[]{SyncInfo.IN_SYNC, SyncInfo.OUTGOING | SyncInfo.CHANGE});
+ assertProperVisibleItems();
+ }
+
+ public void testEmptyFolderChange() throws CoreException {
+ IProject project = createProject(new String[]{"file.txt", "folder1/file2.txt", "folder1/folder2/file3.txt", "folder3/"});
+ adjustSet(set, project,
+ new String[]{"folder1/folder2/", "folder1/folder2/file3.txt"},
+ new int[]{SyncInfo.CONFLICTING | SyncInfo.CHANGE, SyncInfo.CONFLICTING | SyncInfo.CHANGE});
+ assertProperVisibleItems();
+
+ adjustSet(set, project,
+ new String[]{"folder1/folder2/", "folder1/folder2/file3.txt"},
+ new int[]{SyncInfo.IN_SYNC, SyncInfo.OUTGOING | SyncInfo.CHANGE});
+ assertProperVisibleItems();
+
+ adjustSet(set, project,
+ new String[]{"folder1/folder2/file3.txt"},
+ new int[]{SyncInfo.IN_SYNC});
+ assertProperVisibleItems();
+
+ adjustSet(set, project,
+ new String[]{"folder3/"},
+ new int[]{SyncInfo.INCOMING | SyncInfo.ADDITION});
+ assertProperVisibleItems();
+ }
+}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java
new file mode 100644
index 000000000..2a1150ac8
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/synchronize/TestSyncInfo.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.synchronize;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.synchronize.SyncInfo;
+
+public class TestSyncInfo extends SyncInfo {
+
+ private int kind;
+
+ public TestSyncInfo(IResource resource, int kind) throws TeamException {
+ super(resource, null, null, null);
+ this.kind = kind;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.SyncInfo#calculateKind()
+ */
+ protected int calculateKind() throws TeamException {
+ return this.kind;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.core.subscribers.SyncInfo#getKind()
+ */
+ public int getKind() {
+ return kind;
+ }
+}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java
new file mode 100644
index 000000000..f6047411a
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/ContentProviderTestView.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.views;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.ui.*;
+import org.eclipse.ui.part.ViewPart;
+
+public class ContentProviderTestView extends ViewPart {
+
+ public static final String VIEW_ID = "org.eclipse.team.tests.ui.views.ContentProviderTestView";
+
+ private TestTreeViewer viewer;
+
+ public static ContentProviderTestView findViewInActivePage(IWorkbenchPage activePage) {
+ try {
+ if (activePage == null) {
+ activePage = TeamUIPlugin.getActivePage();
+ if (activePage == null) return null;
+ }
+ IViewPart part = activePage.findView(VIEW_ID);
+ if (part == null)
+ part = activePage.showView(VIEW_ID);
+ return (ContentProviderTestView)part;
+ } catch (PartInitException pe) {
+ return null;
+ }
+ }
+
+ public ContentProviderTestView() {
+ }
+
+ public void createPartControl(Composite parent) {
+ viewer = new TestTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ }
+
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ public TestTreeViewer getViewer() {
+ return viewer;
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java
new file mode 100644
index 000000000..7803f5ff2
--- /dev/null
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ui/views/TestTreeViewer.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ui.views;
+
+import org.eclipse.compare.structuremergeviewer.DiffNode;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.*;
+
+public class TestTreeViewer extends TreeViewer {
+
+ public TestTreeViewer(Composite parent) {
+ super(parent);
+ }
+
+ public TestTreeViewer(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ public TestTreeViewer(Tree tree) {
+ super(tree);
+ }
+
+ public Item[] getRootItems() {
+ expandAll();
+ return getChildren(getControl());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.AbstractTreeViewer#getChildren(org.eclipse.swt.widgets.Widget)
+ */
+ public Item[] getChildren(Widget o) {
+ return super.getChildren(o);
+ }
+
+ public boolean hasItemFor(DiffNode node) {
+ return findItem(node) != null;
+ }
+}
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00007.html b/tests/org.eclipse.team.tests.cvs.core/html/00007.html
index 68904853b..ef9fada1a 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00007.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00007.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Check Out - prompts</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<ul>
<li>Select a project in HEAD</li>
<li>Perform a Checkout</li>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00009.html b/tests/org.eclipse.team.tests.cvs.core/html/00009.html
index 1b69e3947..2615c2c18 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00009.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00009.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Remote resources</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<h4>Compare With... in Repositories view </h4>
<p>Perform the following steps:</p>
<ol>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00011.html b/tests/org.eclipse.team.tests.cvs.core/html/00011.html
index e8871cb6e..b0f3dc5f5 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00011.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00011.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Sync View operations and selection</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<p>Ensure Commit and Update buttons:</p>
<ul>
<li>operate on all applicable visible changes</li>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00013.html b/tests/org.eclipse.team.tests.cvs.core/html/00013.html
index f99e30045..57143b3c6 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00013.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00013.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Sync View operations and selection</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<ul>
<li>Same scenarios as <a href="html/00011.html">Sync View operations and selection</a> except you can't commit.
<li>Test mark as merged (ensure that it can work on large data sets
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00016.html b/tests/org.eclipse.team.tests.cvs.core/html/00016.html
index 29bfb36ff..efbf71f31 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00016.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00016.html
@@ -5,7 +5,7 @@
</head><body><h2>Sync View modes and working sets</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
Ensure that choosing modes and working sets
<ul>
<li>result in proper filtering
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00018.html b/tests/org.eclipse.team.tests.cvs.core/html/00018.html
index 35f57eda7..e69d3f179 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00018.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00018.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Editor Linking</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<ol>
<li>Open the Resource History view and enable editor linking</li>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00019.html b/tests/org.eclipse.team.tests.cvs.core/html/00019.html
index 9e5392a4d..187e5015b 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00019.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00019.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Crash Recovery</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<p>Scenario 1</p>
<ol>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00021.html b/tests/org.eclipse.team.tests.cvs.core/html/00021.html
index c7270ad03..aca77c05f 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00021.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00021.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Close and disconnect</h2>
<p>Since: 3.0 M5<br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<h4>Background refresh and disconnect</h4>
<ol>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00022.html b/tests/org.eclipse.team.tests.cvs.core/html/00022.html
index d8dbbc2fd..d6efc6d52 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00022.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00022.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Persistance and deletion</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/19 21:41:32 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<ul>
<li>Select a project and perform a merge.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00023.html b/tests/org.eclipse.team.tests.cvs.core/html/00023.html
index 1dc996d3e..c30bee182 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00023.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00023.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Restarting Workbench</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/20 22:20:45 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
Answer comes here.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00024.html b/tests/org.eclipse.team.tests.cvs.core/html/00024.html
index 2942db38a..f4212d696 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00024.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00024.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Annotate</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/11/20 22:20:45 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<h4>Annotate action should be available from</h4>
<ul>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00025.html b/tests/org.eclipse.team.tests.cvs.core/html/00025.html
index e4c086d14..d62f4560c 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00025.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00025.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Synchronize View Settings</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/11/20 22:20:45 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<h4>Saved between sessions</h4>
<p>The following GUI preferences in the Synchronize View are persisted between workbench
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00026.html b/tests/org.eclipse.team.tests.cvs.core/html/00026.html
index 2dd54b238..3836925ae 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00026.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00026.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Sharing</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
Answer comes here.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00027.html b/tests/org.eclipse.team.tests.cvs.core/html/00027.html
index 35b50d6f9..d1d82b27c 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00027.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00027.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><body><h2>Sharing as a subfolder</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p>
<p>Perform the following steps:</p>
<ol>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00028.html b/tests/org.eclipse.team.tests.cvs.core/html/00028.html
index 0aa50f2f6..f8dfc2d88 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00028.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00028.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Reconnecting to existing</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/12/15 19:11:59 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<p>
The following scenario represents how a user would reconnect a project that does
not contain CVS meta-data to it's remote counterpart. It is assumed that the local project
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00029.html b/tests/org.eclipse.team.tests.cvs.core/html/00029.html
index 0b4fd3464..5977ac65f 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00029.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00029.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Patching</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/12/15 19:19:45 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
Answer comes here.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00029a.html b/tests/org.eclipse.team.tests.cvs.core/html/00029a.html
index 135b9f8c1..b7bc11253 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00029a.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00029a.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Server version compatibiliity</h2>
<p>Since: M6<br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
This test is to ensure that the ssh2 connection method properly delagates to ssh1
when the server only supports ssh1.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00030.html b/tests/org.eclipse.team.tests.cvs.core/html/00030.html
index e2ca35963..6d78d13c8 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00030.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00030.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Importing a zip over a shared project</h2>
<p>Since: 3.0 M6<br>
-Last Modified: $Date: 2003/12/15 19:19:45 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
<p>This scenario captures one means of patching. It assumes that a zip file contains
a previous version of a project that has been modified in some way and added to
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00030a.html b/tests/org.eclipse.team.tests.cvs.core/html/00030a.html
index 977ba7454..15c1cb1e2 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00030a.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00030a.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>Proxies</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
Using HTTP and SOCKS5 proxies.
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00032.html b/tests/org.eclipse.team.tests.cvs.core/html/00032.html
index 1b9bec9b0..93f8a0edc 100644
--- a/tests/org.eclipse.team.tests.cvs.core/html/00032.html
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00032.html
@@ -4,7 +4,7 @@
<meta NAME="since" content="">
</head><h2>General use</h2>
<p>Since: <br>
-Last Modified: $Date: 2003/11/27 22:04:58 $</p><body>
+Last Modified: $Date: 2004/01/13 18:46:26 $</p><body>
This tests the prompting and usage of the SSH2 connection method:
<ul>
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00033.html b/tests/org.eclipse.team.tests.cvs.core/html/00033.html
new file mode 100644
index 000000000..811c50546
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00033.html
@@ -0,0 +1,11 @@
+<html><head><title>Annotate</title>
+<LINK REL=STYLESHEET HREF=../book.css CHARSET=ISO-8859-1 TYPE=text/css>
+<meta NAME="keywords" content="">
+<meta NAME="since" content="">
+</head><h2>Annotate</h2>
+<p>Since: <br>
+Last Modified: $Date: 2004/02/21 01:46:02 $</p><body>
+
+Answer comes here.
+
+</body></html> \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00034.html b/tests/org.eclipse.team.tests.cvs.core/html/00034.html
new file mode 100644
index 000000000..9940287c4
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00034.html
@@ -0,0 +1,11 @@
+<html><head><title>Show Annotation Action</title>
+<LINK REL=STYLESHEET HREF=../book.css CHARSET=ISO-8859-1 TYPE=text/css>
+<meta NAME="keywords" content="">
+<meta NAME="since" content="">
+</head><h2>Show Annotation Action</h2>
+<p>Since: <br>
+Last Modified: $Date: 2004/02/21 01:46:02 $</p><body>
+
+Answer comes here.
+
+</body></html> \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00035.html b/tests/org.eclipse.team.tests.cvs.core/html/00035.html
new file mode 100644
index 000000000..acffdefcd
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00035.html
@@ -0,0 +1,11 @@
+<html><head><title>Label Decorations</title>
+<LINK REL=STYLESHEET HREF=../book.css CHARSET=ISO-8859-1 TYPE=text/css>
+<meta NAME="keywords" content="">
+<meta NAME="since" content="">
+</head><h2>Label Decorations</h2>
+<p>Since: <br>
+Last Modified: $Date: 2004/02/21 01:46:02 $</p><body>
+
+Answer comes here.
+
+</body></html> \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00036.html b/tests/org.eclipse.team.tests.cvs.core/html/00036.html
new file mode 100644
index 000000000..80bda258b
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00036.html
@@ -0,0 +1,11 @@
+<html><head><title>Enablement at startup</title>
+<LINK REL=STYLESHEET HREF=../book.css CHARSET=ISO-8859-1 TYPE=text/css>
+<meta NAME="keywords" content="">
+<meta NAME="since" content="">
+</head><h2>Enablement at startup</h2>
+<p>Since: <br>
+Last Modified: $Date: 2004/02/21 01:46:02 $</p><body>
+
+Answer comes here.
+
+</body></html> \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00037.html b/tests/org.eclipse.team.tests.cvs.core/html/00037.html
new file mode 100644
index 000000000..2bd64b88c
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00037.html
@@ -0,0 +1,11 @@
+<html><head><title>Customizations</title>
+<LINK REL=STYLESHEET HREF=../book.css CHARSET=ISO-8859-1 TYPE=text/css>
+<meta NAME="keywords" content="">
+<meta NAME="since" content="">
+</head><h2>Customizations</h2>
+<p>Since: <br>
+Last Modified: $Date: 2004/02/21 01:46:02 $</p><body>
+
+Answer comes here.
+
+</body></html> \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/html/00038.html b/tests/org.eclipse.team.tests.cvs.core/html/00038.html
new file mode 100644
index 000000000..407b9fe6c
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/html/00038.html
@@ -0,0 +1,11 @@
+<html><head><title>Decorations in the Synchronize pages</title>
+<LINK REL=STYLESHEET HREF=../book.css CHARSET=ISO-8859-1 TYPE=text/css>
+<meta NAME="keywords" content="">
+<meta NAME="since" content="">
+</head><h2>Decorations in the Synchronize pages</h2>
+<p>Since: <br>
+Last Modified: $Date: 2004/02/21 01:46:02 $</p><body>
+
+Answer comes here.
+
+</body></html> \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch b/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch
index 3d3f131ff..84bb2f295 100644
--- a/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch
+++ b/tests/org.eclipse.team.tests.cvs.core/launchConfigurations/One CVS Test.launch
@@ -1,17 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
- <stringAttribute key="vmargs" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName=testFileAdditions"/>
- <booleanAttribute key="askclear" value="false"/>
- <booleanAttribute key="default" value="true"/>
- <booleanAttribute key="clearws" value="true"/>
- <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
- <stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.debug.ui.javaSourceLocator"/>
- <stringAttribute key="location0" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace"/>
- <stringAttribute
- key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
- <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
- <stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
- <stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
- <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.provider.IsModifiedTests"/>
- <stringAttribute key="progargs" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
+<booleanAttribute key="clearws" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.core.subscriber.CVSWorkspaceSubscriberTest"/>
+<booleanAttribute key="tracing" value="false"/>
+<stringAttribute key="vmargs" value="-Declipse.cvs.properties=c:\eclipse\repository.properties -Declipse.cvs.testName=testFolderConflict"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="onePluginID" value=""/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<stringAttribute key="progargs" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="onePlugin" value="false"/>
+<stringAttribute key="location0" value="C:\Eclipse\Latest-Eclipse-Drop\eclipse\runtime-test-workspace"/>
+<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.debug.ui.javaSourceLocator"/>
</launchConfiguration>
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 fd618b462..d80a52980 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
@@ -22,6 +22,7 @@ import org.eclipse.core.tests.harness.EclipseWorkspaceTest;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.*;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
@@ -31,7 +32,6 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.SyncFileChangeListener;
import org.eclipse.team.internal.ccvs.ui.operations.*;
-import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
import org.eclipse.team.tests.ccvs.ui.HeadlessCVSRunnableContext;
public class EclipseTest extends EclipseWorkspaceTest {
@@ -766,8 +766,27 @@ public class EclipseTest extends EclipseWorkspaceTest {
waitForJobCompletion(SyncFileChangeListener.getDeferredHandler().getEventHandlerJob());
}
- public static void waitForSubscriberInputHandling(SubscriberInput input) {
- waitForJobCompletion(input.getEventHandler().getEventHandlerJob());
+ public static void waitForSubscriberInputHandling(SubscriberSyncInfoCollector input) {
+ input.waitForCollector(new IProgressMonitor() {
+ public void beginTask(String name, int totalWork) {
+ }
+ public void done() {
+ }
+ public void internalWorked(double work) {
+ }
+ public boolean isCanceled() {
+ return false;
+ }
+ public void setCanceled(boolean value) {
+ }
+ public void setTaskName(String name) {
+ }
+ public void subTask(String name) {
+ }
+ public void worked(int work) {
+ while (Display.getCurrent().readAndDispatch()) {}
+ }
+ });
}
protected static void executeHeadless(CVSOperation op) throws CVSException {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
index d1a01d7be..7c5d3572b 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
@@ -13,33 +13,17 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import junit.framework.*;
+
import org.eclipse.core.internal.plugins.PluginDescriptor;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteModule;
+import org.eclipse.team.internal.ccvs.core.resources.*;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
@@ -157,10 +141,10 @@ public class ModuleTest extends EclipseTest {
public void testSelfReferencingModule() throws TeamException, CoreException, IOException {
uploadProject("project1");
IProject project1 = checkoutProject("project1", null);
- IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project1, CVSTag.DEFAULT, DEFAULT_MONITOR);
- assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(project1), (ICVSResource)tree.getRemote(), false, false);
+ ICVSRemoteResource tree = CVSWorkspaceRoot.getRemoteTree(project1, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(project1), tree, false, false);
RemoteModule module = getRemoteModule("project1");
- assertEquals(Path.EMPTY, (RemoteFolder)tree.getRemote(), module, false);
+ assertEquals(Path.EMPTY, (RemoteFolder)tree, module, false);
}
/*
@@ -173,16 +157,16 @@ public class ModuleTest extends EclipseTest {
public void testFlattenedStructure() throws TeamException, CoreException, IOException {
IProject docs = checkoutProject("docs", null);
- IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(docs, CVSTag.DEFAULT, DEFAULT_MONITOR);
- assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(docs), (ICVSResource)tree.getRemote(), false, false);
+ ICVSRemoteResource tree = CVSWorkspaceRoot.getRemoteTree(docs, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(docs), tree, false, false);
RemoteModule module = getRemoteModule("docs");
- assertEquals(Path.EMPTY, (RemoteFolder)tree.getRemote(), module, false);
+ assertEquals(Path.EMPTY, (RemoteFolder)tree, module, false);
IProject macros = checkoutProject("macros", null);
- tree = CVSWorkspaceRoot.getRemoteSyncTree(macros, CVSTag.DEFAULT, DEFAULT_MONITOR);
- assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(macros), (ICVSResource)tree.getRemote(), false, false);
+ tree = CVSWorkspaceRoot.getRemoteTree(macros, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(macros), tree, false, false);
module = getRemoteModule("macros");
- assertEquals(Path.EMPTY, (RemoteFolder)tree.getRemote(), module, false);
+ assertEquals(Path.EMPTY, (RemoteFolder)tree, module, false);
}
@@ -197,18 +181,18 @@ public class ModuleTest extends EclipseTest {
public void testIncludeAndExcludeDocs() throws TeamException, CoreException, IOException {
uploadProject("project2");
IProject project2 = checkoutProject("project2", null);
- IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project2, CVSTag.DEFAULT, DEFAULT_MONITOR);
- assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(project2), (ICVSResource)tree.getRemote(), false, false);
+ ICVSRemoteResource tree = CVSWorkspaceRoot.getRemoteTree(project2, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(project2), tree, false, false);
RemoteModule module = getRemoteModule("project2");
- assertEquals(Path.EMPTY, (RemoteFolder)tree.getRemote(), module, false);
+ assertEquals(Path.EMPTY, (RemoteFolder)tree, module, false);
project2 = checkoutProject("project2-only", null);
- tree = CVSWorkspaceRoot.getRemoteSyncTree(project2, CVSTag.DEFAULT, DEFAULT_MONITOR);
- assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(project2), (ICVSResource)tree.getRemote(), false, false);
+ tree = CVSWorkspaceRoot.getRemoteTree(project2, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(project2), tree, false, false);
module = getRemoteModule("project2-only");
- assertEquals(Path.EMPTY, (RemoteFolder)tree.getRemote(), module, false);
+ assertEquals(Path.EMPTY, (RemoteFolder)tree, module, false);
}
@@ -223,15 +207,15 @@ public class ModuleTest extends EclipseTest {
public void testAliasForFiles() throws TeamException, CoreException, IOException {
uploadProject("project3");
IProject project3 = checkoutProject("project3-sub", null);
- IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project3, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ ICVSRemoteResource tree = CVSWorkspaceRoot.getRemoteTree(project3, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project3), (ICVSResource)tree.getRemote(), false, false);
project3 = checkoutProject("project3-src", null);
- tree = CVSWorkspaceRoot.getRemoteSyncTree(project3, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteTree(project3, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project3), (ICVSResource)tree.getRemote(), false, false);
project3 = checkoutProject("project3-src_file", null);
- tree = CVSWorkspaceRoot.getRemoteSyncTree(project3, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteTree(project3, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project3), (ICVSResource)tree.getRemote(), false, false);
}
@@ -246,15 +230,15 @@ public class ModuleTest extends EclipseTest {
public void testAliases() throws TeamException, CoreException, IOException {
uploadProject("project7");
IProject project7 = checkoutProject("project7-common", null);
- IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project7, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ ICVSRemoteResource tree = CVSWorkspaceRoot.getRemoteTree(project7, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project7), (ICVSResource)tree.getRemote(), false, false);
project7 = checkoutProject("project7-pc", null);
- tree = CVSWorkspaceRoot.getRemoteSyncTree(project7, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteTree(project7, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project7), (ICVSResource)tree.getRemote(), false, false);
project7 = checkoutProject("project7-linux", null);
- tree = CVSWorkspaceRoot.getRemoteSyncTree(project7, CVSTag.DEFAULT, DEFAULT_MONITOR);
+ tree = CVSWorkspaceRoot.getRemoteTree(project7, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project7), (ICVSResource)tree.getRemote(), false, false);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
index 6e32a158a..eef4fa51e 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
@@ -15,28 +15,13 @@ import java.lang.reflect.InvocationTargetException;
import junit.framework.Test;
-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.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.sync.IRemoteResource;
-import org.eclipse.team.core.sync.IRemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
-import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTreeBuilder;
+import org.eclipse.team.core.synchronize.IResourceVariant;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.resources.*;
import org.eclipse.team.internal.ccvs.ui.operations.CheckoutToRemoteFolderOperation;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
@@ -60,7 +45,7 @@ public class RemoteResourceTest extends EclipseTest {
}
protected void getMembers(ICVSRemoteFolder folder, boolean deep) throws TeamException {
- IRemoteResource[] children = folder.members(DEFAULT_MONITOR);
+ ICVSRemoteResource[] children = folder.members(DEFAULT_MONITOR);
if (deep) {
for (int i=0;i<children.length;i++) {
if (children[i].isContainer())
@@ -192,13 +177,13 @@ public class RemoteResourceTest extends EclipseTest {
getProvider(project).checkin(new IResource[] {project}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
// Fetch the remote tree for the version
- IRemoteSyncElement tree = CVSWorkspaceRoot.getRemoteSyncTree(project, v1Tag, DEFAULT_MONITOR);
+ ICVSRemoteResource tree = CVSWorkspaceRoot.getRemoteTree(project, v1Tag, DEFAULT_MONITOR);
// Check out the project version
project = checkoutCopy(project, v1Tag);
// Compare the two
- assertEquals(Path.EMPTY, (ICVSResource)tree.getRemote(), (ICVSResource)CVSWorkspaceRoot.getCVSResourceFor(project), false, false);
+ assertEquals(Path.EMPTY, tree, (ICVSResource)CVSWorkspaceRoot.getCVSResourceFor(project), false, false);
}
/*
@@ -212,8 +197,8 @@ public class RemoteResourceTest extends EclipseTest {
setContentsAndEnsureModified(file, "");
commitResources(project, new String[] {"file.txt"});
- ICVSRemoteResource remote = CVSWorkspaceRoot.getRemoteResourceFor(file);
- InputStream in = remote.getContents(DEFAULT_MONITOR);
+ IResourceVariant remote = (IResourceVariant)CVSWorkspaceRoot.getRemoteResourceFor(file);
+ InputStream in = remote.getStorage(DEFAULT_MONITOR).getContents();
int count = 0;
while(in.read() != -1) {
count++;
@@ -353,8 +338,8 @@ public class RemoteResourceTest extends EclipseTest {
setContentsAndEnsureModified(project.getFile("file1.txt"), contents);
commitProject(project);
project.getFile("file1.txt").delete(false, null);
- ICVSRemoteFile remote = (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(project.getFile("file1.txt"));
- String fetchedContents = asString(remote.getBufferedStorage(DEFAULT_MONITOR).getContents());
+ IResourceVariant remote = (IResourceVariant)CVSWorkspaceRoot.getRemoteResourceFor(project.getFile("file1.txt"));
+ String fetchedContents = asString(remote.getStorage(DEFAULT_MONITOR).getContents());
assertEquals("Contents do not match", contents, fetchedContents);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/AllTestsTeamSubscriber.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/AllTestsTeamSubscriber.java
index 86d9809b1..4368eb558 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/AllTestsTeamSubscriber.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/AllTestsTeamSubscriber.java
@@ -30,6 +30,7 @@ public class AllTestsTeamSubscriber extends EclipseTest {
TestSuite suite = new TestSuite();
suite.addTest(CVSMergeSubscriberTest.suite());
suite.addTest(CVSWorkspaceSubscriberTest.suite());
+ suite.addTest(CVSCompareSubscriberTest.suite());
suite.addTest(SyncSetTests.suite());
CVSSyncSubscriberTest.setSyncSource(new SynchronizeViewTestAdapter());
return new CVSTestSetup(suite);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSCompareSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSCompareSubscriberTest.java
new file mode 100644
index 000000000..90d9d4108
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSCompareSubscriberTest.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ccvs.core.subscriber;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
+
+/**
+ * Tests the CVSMergeSubscriber
+ */
+public class CVSCompareSubscriberTest extends CVSSyncSubscriberTest {
+
+ public static Test suite() {
+ String testName = System.getProperty("eclipse.cvs.testName");
+ if (testName == null) {
+ TestSuite suite = new TestSuite(CVSCompareSubscriberTest.class);
+ return new CVSTestSetup(suite);
+ } else {
+ return new CVSTestSetup(new CVSCompareSubscriberTest(testName));
+ }
+ }
+
+ public CVSCompareSubscriberTest() {
+ super();
+ }
+
+ public CVSCompareSubscriberTest(String name) {
+ super(name);
+ }
+
+ /**
+ * Test the basic changes that can occur when comparing the local workspace to a remote
+ * lineup.
+ */
+ public void testStandardChanges() throws InvocationTargetException, InterruptedException, CVSException, CoreException, IOException {
+ // Create a test project
+ IProject project = createProject("testCompareChanges", new String[]{"file1.txt", "file2.txt", "folder1/", "folder1/a.txt", "folder1/b.txt", "folder2/", "folder2/deleted.txt"});
+ // Checkout and branch a copy
+ CVSTag tag = new CVSTag("v1", CVSTag.VERSION);
+ tagProject(project, tag, true);
+ // Modify the workspace
+ addResources(project, new String[]{"addition.txt", "folderAddition/", "folderAddition/new.txt"}, true);
+ deleteResources(project, new String[]{"folder1/a.txt"}, true);
+ deleteResources(project, new String[] {"folder2/"}, true);
+ // modify file1 - make two revisions
+ appendText(project.getFile("file1.txt"), "Appended text 1", false);
+ commitProject(project);
+ appendText(project.getFile("file1.txt"), "Appended text 2", false);
+ commitProject(project);
+ // modify file2 in both branch and head and ensure it's merged properly
+ appendText(project.getFile("file2.txt"), "appened text", false);
+ commitProject(project);
+ // create a merge subscriber
+ CVSCompareSubscriber subscriber = getSyncInfoSource().createCompareSubscriber(project, tag);
+ // check the sync states
+ assertSyncEquals("testIncomingChanges", subscriber, project,
+ new String[]{
+ "file1.txt",
+ "file2.txt",
+ "folder1/",
+ "folder1/b.txt",
+ "folder1/a.txt",
+ "addition.txt",
+ "folderAddition/",
+ "folderAddition/new.txt",
+ "folder2/",
+ "folder2/deleted.txt"}, true,
+ new int[]{
+ SyncInfo.CHANGE,
+ SyncInfo.CHANGE,
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.ADDITION,
+ SyncInfo.DELETION,
+ SyncInfo.IN_SYNC,
+ SyncInfo.DELETION,
+ SyncInfo.IN_SYNC,
+ SyncInfo.ADDITION});
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ getSyncInfoSource().tearDown();
+ super.tearDown();
+ }
+}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
index 729094d9e..ab4ff8325 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
@@ -21,14 +21,11 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.core.subscribers.*;
+import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
/**
@@ -69,7 +66,7 @@ public class CVSMergeSubscriberTest extends CVSSyncSubscriberTest {
mergeResources(subscriber, infos, allowOverwrite);
}
- private void mergeResources(TeamSubscriber subscriber, SyncInfo[] infos, boolean allowOverwrite) throws TeamException, InvocationTargetException, InterruptedException {
+ private void mergeResources(Subscriber subscriber, SyncInfo[] infos, boolean allowOverwrite) throws TeamException, InvocationTargetException, InterruptedException {
TestMergeUpdateAction action = new TestMergeUpdateAction(allowOverwrite);
action.getRunnable(new SyncInfoSet(infos)).run(DEFAULT_MONITOR);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
index c65d34f9b..66caa4549 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSSyncSubscriberTest.java
@@ -11,37 +11,27 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import junit.framework.AssertionFailedError;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.ITeamResourceChangeListener;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamDelta;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.core.sync.RemoteSyncElement;
+import org.eclipse.team.core.subscribers.*;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSSyncTreeSubscriber;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.tests.ccvs.ui.SynchronizeViewTestAdapter;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
/**
* Provides test methods common to CVS sync subscribers
*/
public abstract class CVSSyncSubscriberTest extends EclipseTest {
- private ITeamResourceChangeListener listener;
+ private ISubscriberChangeListener listener;
private List accumulatedTeamDeltas = new ArrayList();
private static SyncInfoSource source = new SynchronizeViewTestAdapter();
@@ -57,8 +47,8 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
source = newSource;
}
- protected TeamSubscriber getWorkspaceSubscriber() throws TeamException {
- TeamSubscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
+ protected Subscriber getWorkspaceSubscriber() throws TeamException {
+ Subscriber subscriber = CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber();
if (subscriber == null) fail("The CVS sync subsciber is not registered");
return subscriber;
}
@@ -68,7 +58,7 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
return source;
}
- protected void refresh(TeamSubscriber subscriber, IResource resource) throws TeamException {
+ protected void refresh(Subscriber subscriber, IResource resource) throws TeamException {
getSyncInfoSource().refresh(subscriber, resource);
}
@@ -76,7 +66,7 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
* Assert that the specified resources in the subscriber have the specified sync kind
* Ignore conflict types if they are not specified in the assert statement
*/
- protected void assertSyncEquals(String message, TeamSubscriber subscriber, IContainer root, String[] resourcePaths, boolean refresh, int[] syncKinds) throws CoreException, TeamException {
+ protected void assertSyncEquals(String message, Subscriber subscriber, IContainer root, String[] resourcePaths, boolean refresh, int[] syncKinds) throws CoreException, TeamException {
assertTrue(resourcePaths.length == syncKinds.length);
if (refresh) refresh(subscriber, root);
IResource[] resources = getResources(root, resourcePaths);
@@ -86,7 +76,7 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
}
- protected void assertSyncEquals(String message, TeamSubscriber subscriber, IResource resource, int syncKind) throws TeamException {
+ protected void assertSyncEquals(String message, Subscriber subscriber, IResource resource, int syncKind) throws TeamException {
int conflictTypeMask = 0x0F; // ignore manual and auto merge sync types for now.
SyncInfo info = getSyncInfo(subscriber, resource);
int kind;
@@ -97,11 +87,11 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
kind = info.getKind() & conflictTypeMask;
}
assertTrue(message + ": improper sync state for " + resource + " expected " +
- RemoteSyncElement.kindToString(kindOther) + " but was " +
- RemoteSyncElement.kindToString(kind), kind == kindOther);
+ SyncInfo.kindToString(kindOther) + " but was " +
+ SyncInfo.kindToString(kind), kind == kindOther);
}
- protected SyncInfo getSyncInfo(TeamSubscriber subscriber, IResource resource) throws TeamException {
+ protected SyncInfo getSyncInfo(Subscriber subscriber, IResource resource) throws TeamException {
return getSyncInfoSource().getSyncInfo(subscriber, resource);
}
@@ -109,13 +99,13 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
* @param changes
* @param resources
*/
- protected void assertSyncChangesMatch(TeamDelta[] changes, IResource[] resources) {
+ protected void assertSyncChangesMatch(ISubscriberChangeEvent[] changes, IResource[] resources) {
// First, ensure that all the resources appear in the delta
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
boolean found = false;
for (int j = 0; j < changes.length; j++) {
- TeamDelta delta = changes[j];
+ ISubscriberChangeEvent delta = changes[j];
if (delta.getResource().equals(resource)) {
found = true;
break;
@@ -203,14 +193,14 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
return (IResource[]) affected.toArray(new IResource[affected.size()]);
}
- protected TeamDelta[] deregisterSubscriberListener(TeamSubscriber subscriber) throws TeamException {
+ protected ISubscriberChangeEvent[] deregisterSubscriberListener(Subscriber subscriber) throws TeamException {
subscriber.removeListener(listener);
- return (TeamDelta[]) accumulatedTeamDeltas.toArray(new TeamDelta[accumulatedTeamDeltas.size()]);
+ return (ISubscriberChangeEvent[]) accumulatedTeamDeltas.toArray(new SubscriberChangeEvent[accumulatedTeamDeltas.size()]);
}
- protected ITeamResourceChangeListener registerSubscriberListener(TeamSubscriber subscriber) throws TeamException {
- listener = new ITeamResourceChangeListener() {
- public void teamResourceChanged(TeamDelta[] deltas) {
+ protected ISubscriberChangeListener registerSubscriberListener(Subscriber subscriber) throws TeamException {
+ listener = new ISubscriberChangeListener() {
+ public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
accumulatedTeamDeltas.addAll(Arrays.asList(deltas));
}
};
@@ -219,7 +209,7 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
return listener;
}
- protected SyncInfo[] createSyncInfos(TeamSubscriber subscriber, IResource[] resources) throws TeamException {
+ protected SyncInfo[] createSyncInfos(Subscriber subscriber, IResource[] resources) throws TeamException {
SyncInfo[] result = new SyncInfo[resources.length];
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
@@ -228,7 +218,7 @@ public abstract class CVSSyncSubscriberTest extends EclipseTest {
return result;
}
- protected void assertProjectRemoved(TeamSubscriber subscriber, IProject project) throws TeamException {
+ protected void assertProjectRemoved(Subscriber subscriber, IProject project) throws TeamException {
getSyncInfoSource().assertProjectRemoved(subscriber, project);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
index 64af9a52d..221a261c8 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.*;
+import org.eclipse.team.core.synchronize.*;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -31,7 +32,6 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.subscriber.CVSSubscriberAction;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
/**
* This class tests the CVSWorkspaceSubscriber
@@ -153,7 +153,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
registerSubscriberListener();
super.addResources(resources);
- TeamDelta[] changes = deregisterSubscriberListener();
+ ISubscriberChangeEvent[] changes = deregisterSubscriberListener();
assertSyncChangesMatch(changes, (IResource[]) affected.toArray(new IResource[affected.size()]));
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
@@ -178,7 +178,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
IResource[] affected = collect(resources, new ResourceCondition(), IResource.DEPTH_INFINITE);
registerSubscriberListener();
super.deleteResources(resources);
- TeamDelta[] changes = deregisterSubscriberListener();
+ ISubscriberChangeEvent[] changes = deregisterSubscriberListener();
assertSyncChangesMatch(changes, affected);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
@@ -191,7 +191,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
}
}
- private TeamDelta[] deregisterSubscriberListener() throws TeamException {
+ private ISubscriberChangeEvent[] deregisterSubscriberListener() throws TeamException {
return deregisterSubscriberListener(getSubscriber());
}
@@ -207,7 +207,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
}, IResource.DEPTH_INFINITE);
registerSubscriberListener();
super.commitResources(resources, depth);
- TeamDelta[] changes = deregisterSubscriberListener();
+ ISubscriberChangeEvent[] changes = deregisterSubscriberListener();
assertSyncChangesMatch(changes, affected);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
@@ -228,7 +228,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
}, IResource.DEPTH_INFINITE);
registerSubscriberListener();
super.unmanageResources(resources);
- TeamDelta[] changes = deregisterSubscriberListener();
+ ISubscriberChangeEvent[] changes = deregisterSubscriberListener();
assertSyncChangesMatch(changes, affected);
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
@@ -915,48 +915,6 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
SyncInfo.IN_SYNC,
SyncInfo.IN_SYNC});
}
-
- /*
- * Test changes using a granularity of contents
- */
- public void testGranularityContents() throws TeamException, CoreException, IOException {
- // Create a test project (which commits it as well)
- IProject project = createProject(new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
-
- // Checkout a copy and make some modifications
- IProject copy = checkoutCopy(project, "-copy");
- appendText(copy.getFile("file1.txt"), "same text", false);
- setContentsAndEnsureModified(copy.getFile("folder1/a.txt"), " unique text"); // whitespace difference
- commitProject(copy);
-
- // Make the same modifications to the original
- appendText(project.getFile("file1.txt"), "same text", false);
- setContentsAndEnsureModified(project.getFile("folder1/a.txt"), "unique text"); // whitespace difference
-
- // Get the sync tree for the project
- String oldId = getSubscriber().getCurrentComparisonCriteria().getId();
- try {
- getSubscriber().setCurrentComparisonCriteria(ContentComparisonCriteria.ID_DONTIGNORE_WS);
- assertSyncEquals("testGranularityContents", project,
- new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
- true, new int[] {
- SyncInfo.IN_SYNC,
- SyncInfo.IN_SYNC,
- SyncInfo.CONFLICTING | SyncInfo.CHANGE });
- getSubscriber().setCurrentComparisonCriteria(ContentComparisonCriteria.ID_IGNORE_WS);
- // TODO: Should not need to reset after a comparison criteria change (bug 46678)
- getSyncInfoSource().reset(getSubscriber());
- assertSyncEquals("testGranularityContents", project,
- new String[] { "file1.txt", "folder1/", "folder1/a.txt"},
- true, new int[] {
- SyncInfo.IN_SYNC,
- SyncInfo.IN_SYNC,
- SyncInfo.IN_SYNC });
- } finally {
- getSubscriber().setCurrentComparisonCriteria(oldId);
- }
-
- }
public void testSyncOnBranch() throws TeamException, CoreException, IOException {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
index e55253553..6eddc52dc 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncInfoSource.java
@@ -10,9 +10,7 @@
*******************************************************************************/
package org.eclipse.team.tests.ccvs.core.subscriber;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+import java.util.*;
import junit.framework.AssertionFailedError;
@@ -21,10 +19,9 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.core.subscribers.Subscriber;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.internal.ccvs.core.*;
/**
* This class acts as the source for the sync info used by the subscriber tests.
@@ -35,6 +32,7 @@ public class SyncInfoSource {
protected static IProgressMonitor DEFAULT_MONITOR = new NullProgressMonitor();
protected List mergeSubscribers = new ArrayList();
+ protected List compareSubscribers = new ArrayList();
public CVSMergeSubscriber createMergeSubscriber(IProject project, CVSTag root, CVSTag branch) {
CVSMergeSubscriber subscriber = new CVSMergeSubscriber(new IResource[] { project }, root, branch);
@@ -42,21 +40,27 @@ public class SyncInfoSource {
return subscriber;
}
+ public CVSCompareSubscriber createCompareSubscriber(IProject project, CVSTag tag) {
+ CVSCompareSubscriber subscriber = new CVSCompareSubscriber(new IResource[] { project }, tag);
+ compareSubscribers.add(subscriber);
+ return subscriber;
+ }
+
/**
* Return the sync info for the given subscriber for the given resource.
*/
- public SyncInfo getSyncInfo(TeamSubscriber subscriber, IResource resource) throws TeamException {
- return subscriber.getSyncInfo(resource, DEFAULT_MONITOR = new NullProgressMonitor());
+ public SyncInfo getSyncInfo(Subscriber subscriber, IResource resource) throws TeamException {
+ return subscriber.getSyncInfo(resource);
}
/**
* Refresh the subscriber for the given resource
*/
- public void refresh(TeamSubscriber subscriber, IResource resource) throws TeamException {
+ public void refresh(Subscriber subscriber, IResource resource) throws TeamException {
subscriber.refresh(new IResource[] { resource}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
}
- protected void assertProjectRemoved(TeamSubscriber subscriber, IProject project) throws TeamException {
+ protected void assertProjectRemoved(Subscriber subscriber, IProject project) throws TeamException {
IResource[] roots = subscriber.roots();
for (int i = 0; i < roots.length; i++) {
IResource resource = roots[i];
@@ -76,7 +80,7 @@ public class SyncInfoSource {
/**
* Recalculate a sync info from scratch
*/
- public void reset(TeamSubscriber subscriber) throws TeamException {
+ public void reset(Subscriber subscriber) throws TeamException {
// Do nothing
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java
index 7878f29cb..039ddcedd 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/SyncSetTests.java
@@ -13,16 +13,13 @@ package org.eclipse.team.tests.ccvs.core.subscriber;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.*;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.synchronize.sets.SyncSet;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoSet;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
@@ -47,11 +44,11 @@ public class SyncSetTests extends CVSSyncSubscriberTest {
}
class TestSyncInfo extends SyncInfo {
- protected int calculateKind(IProgressMonitor progress) throws TeamException {
+ protected int calculateKind() throws TeamException {
return 0;
}
public TestSyncInfo() throws TeamException {
- super(ResourcesPlugin.getWorkspace().getRoot(), null, null, null, null);
+ super(ResourcesPlugin.getWorkspace().getRoot(), null, null, null);
}
}
@@ -60,7 +57,7 @@ public class SyncSetTests extends CVSSyncSubscriberTest {
* that doesn't validate the actual contents of the sync set.
*/
public void testConcurrentAccessToSyncSet() throws Throwable {
- final SyncSet set = new SyncSet();
+ final SubscriberSyncInfoSet set = new SubscriberSyncInfoSet(null);
final boolean[] done = {false};
final IStatus[] error = {null};
@@ -70,9 +67,9 @@ public class SyncSetTests extends CVSSyncSubscriberTest {
while(! done[0]) {
try {
set.add(new TestSyncInfo());
- set.getOutOfSyncDescendants(ResourcesPlugin.getWorkspace().getRoot());
+ set.getSyncInfos(ResourcesPlugin.getWorkspace().getRoot(), IResource.DEPTH_INFINITE);
set.getSyncInfo(ResourcesPlugin.getWorkspace().getRoot());
- set.allMembers();
+ set.getSyncInfos();
} catch (Exception e) {
error[0] = new Status(IStatus.ERROR, "this", 1, "", e);
return error[0];
@@ -95,11 +92,11 @@ public class SyncSetTests extends CVSSyncSubscriberTest {
for(int i = 0; i < 10000; i++) {
set.add(new TestSyncInfo());
- set.getOutOfSyncDescendants(ResourcesPlugin.getWorkspace().getRoot());
+ set.getSyncInfos(ResourcesPlugin.getWorkspace().getRoot(), IResource.DEPTH_INFINITE);
set.getSyncInfo(ResourcesPlugin.getWorkspace().getRoot());
- set.allMembers();
+ set.getSyncInfos();
set.members(ResourcesPlugin.getWorkspace().getRoot());
- set.reset();
+ set.clear();
}
done[0] = true;
if(error[0] != null) {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
index 692a1fd81..48ff6566e 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
@@ -12,9 +12,9 @@ package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
class TestCommitAction extends SubscriberCommitAction {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java
index deaa3a8ae..35d6e4212 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java
@@ -11,8 +11,8 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberConfirmMergedAction;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
class TestMarkAsMergedAction extends SubscriberConfirmMergedAction {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java
index 8e40682d4..b6c5735ff 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMergeUpdateAction.java
@@ -12,9 +12,9 @@ package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.subscriber.MergeUpdateAction;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
class TestMergeUpdateAction extends MergeUpdateAction {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java
index 7f4b6f437..21a7817f6 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndCommit.java
@@ -11,9 +11,9 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndCommitAction;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
public class TestOverrideAndCommit extends OverrideAndCommitAction {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java
index f31d4c36f..155c1166e 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestOverrideAndUpdate.java
@@ -1,7 +1,7 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndUpdateAction;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
public class TestOverrideAndUpdate extends OverrideAndUpdateAction {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java
index 1007996ec..1bc36c774 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestUpdateAction.java
@@ -11,9 +11,9 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceUpdateAction;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
-import org.eclipse.team.ui.synchronize.actions.SyncInfoSet;
class TestUpdateAction extends WorkspaceUpdateAction {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/HeadlessCVSRunnableContext.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/HeadlessCVSRunnableContext.java
index b36f43c8b..da2804248 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/HeadlessCVSRunnableContext.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/HeadlessCVSRunnableContext.java
@@ -17,10 +17,10 @@ import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ccvs.ui.operations.CVSNonblockingRunnableContext;
-import org.eclipse.team.internal.ccvs.ui.operations.ICVSRunnableContext;
+import org.eclipse.team.internal.ui.actions.ITeamRunnableContext;
+import org.eclipse.team.internal.ui.actions.JobRunnableContext;
-public class HeadlessCVSRunnableContext implements ICVSRunnableContext {
+public class HeadlessCVSRunnableContext implements ITeamRunnableContext {
private boolean background;
private IJobChangeListener listener;
@@ -34,7 +34,7 @@ public class HeadlessCVSRunnableContext implements ICVSRunnableContext {
}
/* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ICVSRunnableContext#run(java.lang.String, org.eclipse.core.runtime.jobs.ISchedulingRule, org.eclipse.jface.operation.IRunnableWithProgress)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITeamRunnableContext#run(java.lang.String, org.eclipse.core.runtime.jobs.ISchedulingRule, org.eclipse.jface.operation.IRunnableWithProgress)
*/
public void run(
String title,
@@ -43,14 +43,14 @@ public class HeadlessCVSRunnableContext implements ICVSRunnableContext {
throws InvocationTargetException, InterruptedException {
if (listener != null) {
- new CVSNonblockingRunnableContext(listener).run("Headless Job", null, true, runnable);
+ new JobRunnableContext(listener, null).run("Headless Job", null, true, runnable);
} else {
runnable.run(new NullProgressMonitor());
}
}
/* (non-Javadoc)
- * @see org.eclipse.team.internal.ccvs.ui.operations.ICVSRunnableContext#getShell()
+ * @see org.eclipse.team.internal.ccvs.ui.operations.ITeamRunnableContext#getShell()
*/
public Shell getShell() {
return null;
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java
index 945f4fc11..4c0efec9b 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/MenuEnablementTest.java
@@ -18,11 +18,7 @@ import java.util.List;
import junit.framework.Test;
import junit.framework.TestSuite;
-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.resources.ResourcesPlugin;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -31,23 +27,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
-import org.eclipse.team.internal.ccvs.ui.actions.AddAction;
-import org.eclipse.team.internal.ccvs.ui.actions.BranchAction;
-import org.eclipse.team.internal.ccvs.ui.actions.CommitAction;
-import org.eclipse.team.internal.ccvs.ui.actions.CompareWithRemoteAction;
-import org.eclipse.team.internal.ccvs.ui.actions.CompareWithRevisionAction;
-import org.eclipse.team.internal.ccvs.ui.actions.CompareWithTagAction;
-import org.eclipse.team.internal.ccvs.ui.actions.GenerateDiffFileAction;
-import org.eclipse.team.internal.ccvs.ui.actions.IgnoreAction;
-import org.eclipse.team.internal.ccvs.ui.actions.MergeAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRemoteAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithTagAction;
-import org.eclipse.team.internal.ccvs.ui.actions.SetKeywordSubstitutionAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ShowResourceInHistoryAction;
-import org.eclipse.team.internal.ccvs.ui.actions.SyncAction;
-import org.eclipse.team.internal.ccvs.ui.actions.TagLocalAction;
-import org.eclipse.team.internal.ccvs.ui.actions.UnmanageAction;
-import org.eclipse.team.internal.ccvs.ui.actions.UpdateAction;
+import org.eclipse.team.internal.ccvs.ui.actions.*;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.ui.IActionDelegate;
@@ -323,22 +303,6 @@ public class MenuEnablementTest extends EclipseTest {
assertEnablement(action, project, UNMANAGED_PARENT, true /* expected enablement */);
}
- public void testCompareWithRemoteAction() throws CoreException, TeamException {
- IActionDelegate action = new CompareWithRemoteAction();
- IProject project = createTestProject(action);
- assertDisabledForCommonReasons(action, project);
- assertEnabledForFolderOnlyOverlap(action, project);
- assertEnablement(action, project, MANAGED, true /* expected enablement */);
- assertEnablement(action, project, MANAGED | ADDED, true /* expected enablement */);
- assertEnablement(action, project, MANAGED | ADDED | UNMANAGED, true /* expected enablement */);
- // true is expected for ignored resources whose parent is not ignored
- assertEnablement(action, project, IGNORED, true /* expected enablement */);
- assertEnablement(action, project, UNMANAGED, true /* expected enablement */);
- assertEnablement(action, project, UNMANAGED_PARENT, false /* expected enablement */);
- // true is expected for ignored resources whose parent is not ignored
- assertEnablement(action, project, UNMANAGED | MANAGED | IGNORED, true /* expected enablement */);
- }
-
public void testCompareWithRevison() throws CoreException, TeamException {
IActionDelegate action = new CompareWithRevisionAction();
IProject project = createTestProject(action);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
index d1c9006af..cb59c581f 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SynchronizeViewTestAdapter.java
@@ -16,17 +16,17 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.core.subscribers.Subscriber;
+import org.eclipse.team.core.subscribers.SubscriberSyncInfoCollector;
+import org.eclipse.team.core.synchronize.*;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.ui.subscriber.CompareParticipant;
import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
-import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.synchronize.sets.SyncSet;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.subscriber.SubscriberParticipant;
/**
* SyncInfoSource that obtains SyncInfo from the SynchronizeView's SyncSet.
@@ -37,12 +37,11 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
TeamUI.getSynchronizeManager().showSynchronizeViewInActivePage(null);
}
- public SyncInfo getSyncInfo(TeamSubscriber subscriber, IResource resource) throws TeamException {
- SubscriberInput input = getInput(subscriber);
- SyncSet set = input.getWorkingSetSyncSet();
+ public SyncInfo getSyncInfo(Subscriber subscriber, IResource resource) throws TeamException {
+ SyncInfoSet set = getCollector(subscriber).getSubscriberSyncInfoSet();
SyncInfo info = set.getSyncInfo(resource);
if (info == null) {
- info = subscriber.getSyncInfo(resource, DEFAULT_MONITOR);
+ info = subscriber.getSyncInfo(resource);
if ((info != null && info.getKind() != SyncInfo.IN_SYNC)) {
throw new AssertionFailedError();
}
@@ -50,31 +49,35 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
return info;
}
- private SubscriberInput getInput(TeamSubscriber subscriber) {
+ private SubscriberParticipant getParticipant(Subscriber subscriber) {
// show the sync view
ISynchronizeParticipant[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants();
for (int i = 0; i < participants.length; i++) {
ISynchronizeParticipant participant = participants[i];
- if(participant instanceof TeamSubscriberParticipant) {
- SubscriberInput input = ((TeamSubscriberParticipant)participant).getInput();
- TeamSubscriber s = input.getSubscriber();
- if(s == subscriber) {
- EclipseTest.waitForSubscriberInputHandling(input);
- return input;
+ if(participant instanceof SubscriberParticipant) {
+ if(((SubscriberParticipant)participant).getSubscriber() == subscriber) {
+ return (SubscriberParticipant)participant;
}
}
}
return null;
}
+
+ private SubscriberSyncInfoCollector getCollector(Subscriber subscriber) {
+ SubscriberParticipant participant = getParticipant(subscriber);
+ if (participant == null) return null;
+ SubscriberSyncInfoCollector syncInfoCollector = participant.getSubscriberSyncInfoCollector();
+ EclipseTest.waitForSubscriberInputHandling(syncInfoCollector);
+ return syncInfoCollector;
+ }
/* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource#assertProjectRemoved(org.eclipse.team.core.subscribers.TeamSubscriber, org.eclipse.core.resources.IProject)
*/
- protected void assertProjectRemoved(TeamSubscriber subscriber, IProject project) throws TeamException {
+ protected void assertProjectRemoved(Subscriber subscriber, IProject project) throws TeamException {
super.assertProjectRemoved(subscriber, project);
- SubscriberInput input = getInput(subscriber);
- SyncSet set = input.getFilteredSyncSet();
- if (set.getOutOfSyncDescendants(project).length != 0) {
+ SyncInfoTree set = getCollector(subscriber).getSyncInfoTree();
+ if (set.hasMembers(project)) {
throw new AssertionFailedError("The sync set still contains resources from the deleted project " + project.getName());
}
}
@@ -95,6 +98,20 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
/* (non-Javadoc)
+ * @see org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource#createCompareSubscriber(org.eclipse.core.resources.IProject, org.eclipse.team.internal.ccvs.core.CVSTag)
+ */
+ public CVSCompareSubscriber createCompareSubscriber(IProject project, CVSTag tag) {
+ CVSCompareSubscriber s = super.createCompareSubscriber(project, tag);
+ ISynchronizeManager synchronizeManager = TeamUI.getSynchronizeManager();
+ ISynchronizeParticipant participant = new CompareParticipant(s);
+ synchronizeManager.addSynchronizeParticipants(
+ new ISynchronizeParticipant[] {participant});
+ ISynchronizeView view = synchronizeManager.showSynchronizeViewInActivePage(null);
+ view.display(participant);
+ return s;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource#tearDown()
*/
public void tearDown() {
@@ -112,16 +129,17 @@ public class SynchronizeViewTestAdapter extends SyncInfoSource {
/* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource#refresh(org.eclipse.team.core.subscribers.TeamSubscriber, org.eclipse.core.resources.IResource)
*/
- public void refresh(TeamSubscriber subscriber, IResource resource) throws TeamException {
+ public void refresh(Subscriber subscriber, IResource resource) throws TeamException {
super.refresh(subscriber, resource);
- EclipseTest.waitForSubscriberInputHandling(getInput(subscriber));
+ // Getting the collector waits for the subscriber input handlers
+ getCollector(subscriber);
}
/* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource#reset()
*/
- public void reset(TeamSubscriber subscriber) throws TeamException {
+ public void reset(Subscriber subscriber) throws TeamException {
super.reset(subscriber);
- getInput(subscriber).reset();
+ getCollector(subscriber).reset();
}
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ArgumentParser.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ArgumentParser.java
deleted file mode 100644
index f206dbed4..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ArgumentParser.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-public class ArgumentParser {
- protected ArgumentParser() {
- }
-
- public boolean parse(String[] args) {
- int index = 0;
- String option = null;
- for (int i = 0; i < args.length; i++) {
- String arg = args[i];
- if (arg == null) continue;
- if (arg.charAt(0) == '-') {
- if (option != null && ! handleOption(option, null)) return false;
- option = arg;
- } else if (option != null) {
- if (! handleOption(option, arg)) return false;
- option = null;
- } else {
- if (! handleArgument(index++, arg)) return false;
- }
- }
- if (option != null && ! handleOption(option, null)) return false;
- return handleFinished();
- }
-
- protected boolean handleFinished() {
- return true;
- }
-
- protected boolean handleArgument(int index, String arg) {
- return false;
- }
-
- protected boolean handleOption(String option, String arg) {
- return false;
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/BenchmarkTestSetup.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/BenchmarkTestSetup.java
deleted file mode 100644
index 0b9ef08ba..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/BenchmarkTestSetup.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import junit.framework.Test;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
-
-public class BenchmarkTestSetup extends CVSTestSetup {
- public static final File BIG_ZIP_FILE;
- public static final File SMALL_ZIP_FILE;
- public static final File TINY_ZIP_FILE;
-
- // Static initializer for constants
- static {
- try {
- BIG_ZIP_FILE = getTestFile("benchmarkBig.zip");
- SMALL_ZIP_FILE = getTestFile("benchmarkSmall.zip");
- TINY_ZIP_FILE = getTestFile("benchmarkTiny.zip");
- } catch (IOException e) {
- throw new Error(e.getMessage());
- }
- }
-
- public static File getTestFile(String name) throws IOException {
- IPluginRegistry registry = Platform.getPluginRegistry();
- IPluginDescriptor descriptor = registry.getPluginDescriptor("org.eclipse.team.tests.cvs.core");
- URL baseURL = descriptor.getInstallURL();
- URL url = new URL(baseURL, "resources/BenchmarkTest/" + name);
- url = Platform.asLocalURL(url);
- if (url.getProtocol().equals("file")) {
- return new File(url.getFile()).getAbsoluteFile();
- }
- throw new IOException("Cannot find test file: " + name);
- }
-
- public BenchmarkTestSetup(Test test) {
- super(test);
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java
deleted file mode 100644
index 5ed517ddc..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CVSUITestCase.java
+++ /dev/null
@@ -1,465 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.Test;
-
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
-import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.actions.AddToWorkspaceAction;
-import org.eclipse.team.internal.ccvs.ui.actions.CommitAction;
-import org.eclipse.team.internal.ccvs.ui.actions.ReplaceWithRemoteAction;
-import org.eclipse.team.internal.ccvs.ui.actions.UpdateAction;
-import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
-import org.eclipse.team.internal.ccvs.ui.operations.TagOperation;
-import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
-import org.eclipse.team.internal.ccvs.ui.sync.CommitSyncAction;
-import org.eclipse.team.internal.ccvs.ui.sync.ForceCommitSyncAction;
-import org.eclipse.team.internal.ccvs.ui.sync.ForceUpdateSyncAction;
-import org.eclipse.team.internal.ccvs.ui.sync.UpdateSyncAction;
-import org.eclipse.team.internal.ccvs.ui.wizards.SharingWizard;
-import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
-import org.eclipse.team.internal.ui.sync.ITeamNode;
-import org.eclipse.team.internal.ui.sync.SyncSet;
-import org.eclipse.team.internal.ui.sync.SyncView;
-import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchException;
-
-public class CVSUITestCase extends LoggingTestCase {
- protected static Set installedTrap = new HashSet();
- private List testWindows;
- protected IWorkbenchWindow testWindow;
- protected CVSRepositoryLocation testRepository;
- protected boolean USE_CONSOLE = System.getProperty("cvs.tests.use_console") != null;
- protected boolean SHOW_CONSOLE = System.getProperty("cvs.tests.show_console") != null;
-
- public CVSUITestCase(Test test) {
- super(test);
- testWindows = new ArrayList(3);
- }
-
- public void setUp() throws CoreException{
- super.setUp();
- testRepository = CVSTestSetup.repository;
- testWindow = openTestWindow();
-
- Display display = testWindow.getShell().getDisplay();
- if (! installedTrap.contains(display)) {
- installedTrap.add(display);
- Utils.waitForErrorDialog(display, 10000 /*ms*/, new Waiter() {
- public boolean notify(Object object) {
- Dialog dialog = (Dialog) object;
- printWarning("Encountered error dialog with title: " + dialog.getShell().getText(), null, null);
- dialog.close();
- return true;
- }
- });
- }
-
- // disable auto-build
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceDescription description = workspace.getDescription();
- description.setAutoBuilding(false);
- try {
- workspace.setDescription(description);
- } catch (CoreException e) {
- throw new CVSException(e);
- }
-
- // disable CVS GZIP compression
- IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
- store.setValue(ICVSUIConstants.PREF_COMPRESSION_LEVEL, 0);
- CVSProviderPlugin.getPlugin().setCompressionLevel(0);
-
- // default case is to not show the console but don't disable it, this is
- // the typical user experience.
- if(SHOW_CONSOLE) {
- //showConsole();
- } else if(!USE_CONSOLE) {
- CVSProviderPlugin.getPlugin().setConsoleListener(null);
- }
-
- // wait for UI to settle
- Utils.processEventsUntil(100);
- }
-
- public void tearDown() throws CVSException {
- // wait for UI to settle
- Utils.processEventsUntil(100);
- closeAllTestWindows();
- super.tearDown();
- }
-
- /**
- * Open a test window with the empty perspective.
- */
- protected IWorkbenchWindow openTestWindow() {
- try {
- IWorkbenchWindow win = PlatformUI.getWorkbench().openWorkbenchWindow(
- EmptyPerspective.PERSP_ID, ResourcesPlugin.getWorkspace());
- testWindows.add(win);
- return win;
- } catch (WorkbenchException e) {
- fail();
- return null;
- }
- }
-
- /**
- * Close all test windows.
- */
- protected void closeAllTestWindows() {
- Iterator iter = testWindows.iterator();
- IWorkbenchWindow win;
- while (iter.hasNext()) {
- win = (IWorkbenchWindow) iter.next();
- win.close();
- }
- testWindows.clear();
- }
-
- /**
- * Checks out the projects with the specified tags from the test repository.
- */
- protected void actionCheckoutProjects(String[] projectNames, CVSTag[] tags) throws Exception {
- ICVSRemoteFolder[] projects = lookupRemoteProjects(projectNames, tags);
- AddToWorkspaceAction action = new AddToWorkspaceAction() {
- protected IPromptCondition getOverwriteLocalAndFileSystemPrompt() {
- return new DummyPromptCondition();
- }
- };
- runActionDelegate(action, projects, "Repository View Checkout action");
- timestampGranularityHiatus();
- }
-
- /**
- * Replaces the specified resources with the remote contents using the action contribution.
- */
- protected void actionReplaceWithRemote(IResource[] resources) {
- ReplaceWithRemoteAction action = new ReplaceWithRemoteAction() {
- protected IPromptCondition getPromptCondition(IResource[] resources) {
- return new DummyPromptCondition();
- }
- };
- runActionDelegate(action, resources, "Replace with Remote action");
- timestampGranularityHiatus();
- }
-
- /**
- * Shares the specified project with the test repository.
- * @param project the project to share
- */
- protected void actionShareProject(IProject project) {
- final SharingWizard wizard = new SharingWizard();
- wizard.init(PlatformUI.getWorkbench(), project);
- Utils.waitForWizardToOpen(testWindow.getShell(), wizard, new Waiter() {
- public boolean notify(Object object) {
- WizardDialog dialog = (WizardDialog) object;
- startTask("set sharing, pop up sync viewer");
- wizard.performFinish();
- endTask();
- dialog.close();
- return false;
- }
- });
- timestampGranularityHiatus();
- }
-
- /**
- * Updates the specified resources using the action contribution.
- */
- protected void actionCVSCommit(IResource[] resources, final String comment) {
- assertNotNull(comment);
- CommitAction action = new CommitAction() {
- protected String promptForComment() {
- return comment;
- }
- };
- runActionDelegate(action, resources, "CVS Commit action");
- timestampGranularityHiatus();
- }
-
- /**
- * Tags the specified resources using the action contribution.
- */
- protected void actionCVSTag(IResource[] resources, final String name) {
- assertNotNull(name);
- ITagOperation op = new TagOperation(null, resources);
- op.setTag(new CVSTag(name, CVSTag.VERSION));
- try {
- op.run();
- } catch (InterruptedException e) {
- printWarning("Tag interrupted", e, null);
- } catch (CVSException e) {
- printWarning("Tag failed", e, null);
- }
- }
-
- /**
- * Updates the specified resources using the action contribution.
- */
- protected void actionCVSUpdate(IResource[] resources) {
- runActionDelegate(new UpdateAction(), resources, "CVS Update action");
- timestampGranularityHiatus();
- }
-
- /**
- * Pops up the synchronizer view for the specified resources.
- * @param resources the resources to sync
- * @return the compare input used
- */
- protected CVSSyncCompareInput syncResources(IResource[] resources) {
- startTask("Synchronize with Repository action");
- SyncView syncView = getSyncView();
- CVSSyncCompareInput input = new CVSSyncCompareInput(resources) {
- // overridden to prevent "nothing to synchronize" dialog from popping up
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException, InterruptedException {
- super.run(monitor);
- DiffNode result = getDiffRoot(); // (DiffNode) getCompareResult()
- if (result == null || Utils.isEmpty(result)) throw new InterruptedException();
- }
- };
- syncView.showSync(input);
- endTask();
- return input;
- }
-
- /**
- * Commits the specified resources using the synchronizer view.
- * @param resources the resources to commit
- * @param input the compare input for the sync view, or null to create a new one
- * @param comment the comment string, or ""
- */
- protected void syncCommitResources(IResource[] resources, CVSSyncCompareInput input, String comment) {
- if (input == null) input = syncResources(resources);
- IDiffContainer diffRoot = input.getDiffRoot();
- if (Utils.isEmpty(diffRoot)) {
- startTask("Nothing to Commit");
- } else {
- ITeamNode[] nodes = getTeamNodesForResources(diffRoot, resources);
- startTask("Sync View Commit action");
- syncCommitInternal(input, nodes, comment);
- }
- endTask();
- timestampGranularityHiatus();
- }
-
- /**
- * Updates the specified resources using the synchronizer view.
- * @param resources the resources to update
- * @param input the compare input for the sync view, or null to create a new one
- * @param comment the comment string, or ""
- */
- protected void syncUpdateResources(IResource[] resources, CVSSyncCompareInput input) {
- if (input == null) input = syncResources(resources);
- IDiffContainer diffRoot = input.getDiffRoot();
- if (Utils.isEmpty(diffRoot)) {
- startTask("Nothing to Update");
- } else {
- ITeamNode[] nodes = getTeamNodesForResources(diffRoot, resources);
- startTask("Sync View Update action");
- syncGetInternal(input, nodes);
- }
- endTask();
- timestampGranularityHiatus();
- }
-
- /**
- * Creates and imports project contents from a zip file.
- */
- protected IProject createAndImportProject(String prefix, File zipFile) throws Exception {
- IProject project = Utils.createUniqueProject(prefix);
- Utils.importZip(project, zipFile);
- return project;
- }
-
- /**
- * Looks up handles for remote projects by name.
- */
- protected ICVSRemoteFolder[] lookupRemoteProjects(String[] projectNames, CVSTag[] tags) throws Exception {
- ICVSRemoteFolder[] folders = new ICVSRemoteFolder[projectNames.length];
- for (int i = 0; i < projectNames.length; ++i) {
- folders[i] = testRepository.getRemoteFolder(projectNames[i], tags[i]);
- }
- return folders;
- }
-
- /**
- * Gets an instance of the Synchronize view
- */
- protected SyncView getSyncView() {
- SyncView view = SyncView.findViewInActivePage(null);
- assertNotNull("Could not obtain a Sync View.", view);
- return view;
- }
-
- /**
- * Runs an IActionDelegate prototype instance on a given selection.
- */
- protected void runActionDelegate(IActionDelegate delegate, Object[] selection, String taskName) {
- Action action = new Action() { };
- if (delegate instanceof IObjectActionDelegate) {
- ((IObjectActionDelegate) delegate).setActivePart(action,
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().getActivePart());
- }
- delegate.selectionChanged(action, new StructuredSelection(selection));
- startTask(taskName);
- delegate.run(action);
- endTask();
- }
-
- /**
- * Commits NON-CONFLICTING and CONFLICTING resources represented by an array of synchronizer nodes.
- */
- private void syncCommitInternal(CVSSyncCompareInput input, ITeamNode[] nodes, final String comment) {
- FakeSelectionProvider selectionProvider = new FakeSelectionProvider(nodes);
- // Commit ONLY NON-CONFLICTING changes
- CommitSyncAction commitAction = new CommitSyncAction(input, selectionProvider, "Commit",
- testWindow.getShell()) {
- protected int promptForConflicts(SyncSet syncSet) {
- return 0; // yes! sync conflicting changes
- }
- protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
- return comment;
- }
- protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
- return unadded;
- }
- };
- commitAction.run();
- // Commit ONLY CONFLICTING changes
- ForceCommitSyncAction forceCommitAction = new ForceCommitSyncAction(input, selectionProvider, "Force Commit",
- testWindow.getShell()) {
- protected int promptForConflicts(SyncSet syncSet) {
- return 0; // yes! sync conflicting changes
- }
- protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
- return comment;
- }
- protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
- return unadded;
- }
- };
- forceCommitAction.run();
- }
-
- /**
- * Updates NON-CONFLICTING and CONFLICTING resources represented by an array of synchronizer nodes.
- */
- private void syncGetInternal(CVSSyncCompareInput input, ITeamNode[] nodes) {
- FakeSelectionProvider selectionProvider = new FakeSelectionProvider(nodes);
- // Update ONLY NON-CONFLICTING changes
- UpdateSyncAction updateAction = new UpdateSyncAction(input, selectionProvider, "Update",
- testWindow.getShell()) {
- protected boolean promptForConflicts() {
- return true;
- }
- protected int promptForMergeableConflicts() {
- return 2;
- }
- };
- updateAction.run();
- // Update ONLY CONFLICTING changes
- ForceUpdateSyncAction forceUpdateAction = new ForceUpdateSyncAction(input, selectionProvider, "Force Update",
- testWindow.getShell()) {
- protected boolean promptForConflicts() {
- return true;
- }
- protected int promptForMergeableConflicts() {
- return 2;
- }
- };
- forceUpdateAction.run();
- }
-
- /**
- * Gets an array of synchronizer nodes corresponding to an array of resouces.
- */
- protected static ITeamNode[] getTeamNodesForResources(IDiffContainer root, IResource[] resources) {
- ITeamNode[] nodes = new ITeamNode[resources.length];
- for (int i = 0; i < resources.length; ++i) {
- nodes[i] = findTeamNodeForResource(root, resources[i]);
- assertNotNull(nodes[i]);
- }
- return nodes;
- }
-
- private static ITeamNode findTeamNodeForResource(IDiffElement root, IResource resource) {
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
- assertNotNull("Resource " + resource.getFullPath() + " must have an associated CVSProvider", provider);
-
- if (root instanceof ITeamNode) {
- ITeamNode node = (ITeamNode) root;
- if (resource.equals(node.getResource())) return node;
- // prune the backtracking tree
- IResource parent = resource.getParent();
- do {
- if (parent == null) return null; // can't possibly be child of this node
- } while (! resource.equals(parent));
- }
- if (root instanceof IDiffContainer) {
- IDiffContainer container = (IDiffContainer) root;
- if (container.hasChildren()) {
- IDiffElement[] children = container.getChildren();
- for (int i = 0; i < children.length; ++i) {
- ITeamNode node = findTeamNodeForResource(children[i], resource);
- if (node != null) return node;
- }
- }
- }
- return null;
- }
-
- /**
- * Waits for a small amount of time to compensate for file system time stamp granularity.
- */
- private void timestampGranularityHiatus() {
- //JUnitTestCase.waitMsec(1500);
- Utils.processEventsUntil(1500);
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CaseEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CaseEntry.java
deleted file mode 100644
index 8b59e3153..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CaseEntry.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import org.xml.sax.Attributes;
-
-public class CaseEntry extends LogEntryContainer {
- private String className;
-
- public CaseEntry(LogEntryContainer parent, Attributes attributes) {
- this(parent, attributes.getValue("name"), attributes.getValue("class"));
- }
-
- public CaseEntry(LogEntryContainer parent, String name, String className) {
- super(parent, name);
- this.className = (className != null) ? className : "unknown";
- }
-
- public void accept(ILogEntryVisitor visitor) {
- visitor.visitCaseEntry(this);
- }
-
- /**
- * Returns the class name of the test case.
- */
- public String getClassName() {
- return className;
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CommandTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CommandTests.java
deleted file mode 100644
index b850dd000..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/CommandTests.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-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.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
-import org.eclipse.team.tests.ccvs.core.CommandLineCVSClient;
-import org.eclipse.team.tests.ccvs.core.EclipseCVSClient;
-import org.eclipse.team.tests.ccvs.core.ICVSClient;
-
-public class CommandTests extends CVSUITestCase {
- private String baseName;
- private IProject referenceProject;
- private IProject eclipseProject;
- private IProject uiProject;
-
- public CommandTests(Test test) {
- super(test);
- }
- public static Test suite() {
- return new BenchmarkTestSetup(new TestSuite(CommandTests.class));
- }
-
- public void setUp() throws CoreException {
- super.setUp();
- try {
- baseName = Utils.makeUniqueName(null, "thisproject", null);
- referenceProject = Utils.createProject(baseName + "-reference");
- eclipseProject = Utils.createProject(baseName + "-eclipse");
- uiProject = Utils.createProject(baseName);
- } catch (CoreException e) {
- throw new CVSException(e);
- }
- }
-
- public void testImportAddCommitCheckout() throws Throwable {
- // import a project using each client
- new ComparativeTest("import/add/commit big project") {
- protected void runCommandTest(final IContainer localRoot, ICVSClient client) throws Exception {
- // use the import command to create a new module
- IFolder folder = localRoot.getFolder(new Path("empty_folder"));
- folder.create(false /*force*/, true /*local*/, null);
- execute(client, "import empty module", folder, "import",
- new String[] { },
- new String[] { "-m", "initial import" },
- new String[] { localRoot.getName(), "vendor", "start" });
- folder.delete(false /*force*/, null);
-
- // checkout the project
- localRoot.delete(false /*force*/, null);
- execute(client, "checkout module", localRoot.getParent(), "co",
- new String[] { },
- new String[] { },
- new String[] { localRoot.getName() });
-
- // prepare contents
- prepareContents(localRoot);
-
- // determine the set of files and folders to be added
- final Map /* from KSubstOption to String */ files = new HashMap();
- final Set /* of String */ folders = new TreeSet();
- final int trim = localRoot.getProjectRelativePath().segmentCount();
- localRoot.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (! resource.equals(localRoot)) {
- String name = resource.getProjectRelativePath().removeFirstSegments(trim).toString();
- if (resource.getType() == IResource.FILE) {
- KSubstOption ksubst = KSubstOption.fromFile((IFile) resource);
- Set set = (Set) files.get(ksubst);
- if (set == null) {
- set = new HashSet();
- files.put(ksubst, set);
- }
- set.add(name);
- } else {
- folders.add(name);
- }
- }
- return true;
- }
- }, IResource.DEPTH_INFINITE, false);
-
- // add all folders
- if (!folders.isEmpty()) {
- executeInParts(client, "add folders", localRoot, "add",
- new String[] { },
- new String[] { },
- (String[])folders.toArray(new String[folders.size()]));
- }
- // add all files
- for (Iterator it = files.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- KSubstOption ksubst = (KSubstOption) entry.getKey();
- Set set = (Set) entry.getValue();
- executeInParts(client, "add files (" + ksubst.getShortDisplayText() + ")", localRoot, "add",
- new String[] { },
- new String[] { ksubst.toString() },
- (String[])set.toArray(new String[set.size()]));
- }
-
- // commit everything
- execute(client, "commit module", localRoot, "ci",
- new String[] { },
- new String[] { "-m", "dummy message" },
- new String[] { });
- }
- protected void runUITest(IContainer localRoot) throws Exception {
- prepareContents(localRoot);
- actionShareProject(uiProject);
- syncCommitResources(new IResource[] { uiProject }, null, "initial");
- }
- private void prepareContents(IContainer localRoot) throws Exception {
- Utils.importZip(localRoot, BenchmarkTestSetup.BIG_ZIP_FILE);
- }
- }.run();
-
- // check it out using each client
- new ComparativeTest("checkout big project") {
- protected void runCommandTest(IContainer localRoot, ICVSClient client) throws Exception {
- execute(client, "checkout module", localRoot.getParent(), "co",
- new String[] { },
- new String[] { "-P" },
- new String[] { localRoot.getName() });
- }
- protected void runUITest(IContainer localRoot) throws Exception {
- actionCheckoutProjects(new String[] { localRoot.getName() }, new CVSTag[] { CVSTag.DEFAULT });
- }
- protected void setUp(IContainer localRoot) throws Exception {
- // delete then recreate the container
- IProject project = (IProject) localRoot;
- Utils.deleteProject(project);
- project.create(null);
- project.open(null);
- // delete the .project file (avoid .project is in the way error)
- IFile file = project.getFile(".project");
- file.delete(false /*force*/, null);
- }
- }.run();
- }
-
- protected abstract class ComparativeTest {
- private String name;
- public ComparativeTest(String name) {
- this.name = name;
- }
- public void run() throws Exception {
- startGroup(name);
-
- startGroup("command line client");
- setUp(referenceProject);
- runCommandTest(referenceProject, CommandLineCVSClient.INSTANCE);
- tearDown(referenceProject);
- endGroup();
-
- startGroup("eclipse client");
- setUp(eclipseProject);
- runCommandTest(eclipseProject, EclipseCVSClient.INSTANCE);
- tearDown(eclipseProject);
- endGroup();
-
- startGroup("user interface");
- setUp(uiProject);
- runUITest(uiProject);
- tearDown(uiProject);
- endGroup();
-
- endGroup();
- }
- protected abstract void runCommandTest(IContainer localRoot, ICVSClient client) throws Exception ;
- protected abstract void runUITest(IContainer localRoot) throws Exception;
- protected void setUp(IContainer localRoot) throws Exception {
- }
- protected void tearDown(IContainer localRoot) throws Exception {
- }
- protected void execute(ICVSClient client, String taskname,
- IContainer localRoot, String command,
- String[] globalOptions, String[] localOptions, String[] arguments) throws CVSException {
- // The execution time for the client will include overhead associated with
- // computing the command to be run and cleaning up Eclipse state once it has
- // completed, including notifying resource delta listener. Since all clients
- // in the Eclipse environment are subject to this overhead, the theory is that
- // it will be a constant factor that we can neglect.
- startTask(taskname);
- client.executeCommand(testRepository, localRoot, command, globalOptions, localOptions, arguments);
- endTask();
- }
- protected void executeInParts(ICVSClient client, String taskname,
- IContainer localRoot, String command,
- String[] globalOptions, String[] localOptions, String[] arguments) throws CVSException {
- // There are problems executing commands with too many arguments
- // so we have to break them up into chunks.
- startTask(taskname);
- int i = 0;
- do {
- int len = Math.min(200, arguments.length - i);
- String[] args;
- if (i == 0 && len == arguments.length) {
- args = arguments;
- } else {
- args = new String[len];
- System.arraycopy(arguments, i, args, 0, len);
- }
- client.executeCommand(testRepository, localRoot, command, globalOptions, localOptions, args);
- i += len;
- } while (arguments.length - i > 0);
- endTask();
- }
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DelimitedValuesWriter.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DelimitedValuesWriter.java
deleted file mode 100644
index 2146320e7..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DelimitedValuesWriter.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.PrintStream;
-
-public class DelimitedValuesWriter {
- private static final String BEGIN_QUOTE = "\"";
- private static final String END_QUOTE = "\"";
- private PrintStream ps;
- private String delimiter;
- private boolean quoted;
- private boolean firstField;
-
- public DelimitedValuesWriter(PrintStream ps, String delimiter, boolean quoted) {
- this.ps = ps;
- this.delimiter = delimiter;
- this.quoted = quoted;
- this.firstField = true;
- }
-
- public void printField(String field) {
- if (firstField) {
- firstField = false;
- } else {
- ps.print(delimiter);
- }
- if (quoted) ps.print(BEGIN_QUOTE);
- ps.print(field);
- if (quoted) ps.print(END_QUOTE);
- }
- public void printFields(String[] fields) {
- for (int i = 0; i < fields.length; i++) {
- printField(fields[i]);
- }
- }
- public void printRecord(String[] fields) {
- printFields(fields);
- endRecord();
- }
- public void endRecord() {
- ps.println();
- firstField = true;
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DummyPromptCondition.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DummyPromptCondition.java
deleted file mode 100644
index 88985f7e7..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/DummyPromptCondition.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
-
-public class DummyPromptCondition implements IPromptCondition {
- public boolean needsPrompt(IResource resource) {
- return false;
- }
- public String promptMessage(IResource resource) {
- // this method should never be called
- return resource.getName();
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/EmptyPerspective.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/EmptyPerspective.java
deleted file mode 100644
index 91435094b..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/EmptyPerspective.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-
-/**
- * This perspective is used for testing api. It defines an initial
- * layout with no parts, just an editor area.
- *
- * Note: originally borrowed from org.eclipse.jdt.junit.eclipse.util
- */
-public class EmptyPerspective implements IPerspectiveFactory {
-
- /**
- * The perspective id.
- */
- public static final String PERSP_ID = "org.eclipse.team.tests.ccvs.ui.EmptyPerspective";
-
- /**
- * Constructs a new Default layout engine.
- */
- public EmptyPerspective() {
- super();
- }
-
- /**
- * Defines the initial layout for a perspective.
- *
- * Implementors of this method may add additional views to a
- * perspective. The perspective already contains an editor folder
- * with <code>ID = ILayoutFactory.ID_EDITORS</code>. Add additional views
- * to the perspective in reference to the editor folder.
- *
- * This method is only called when a new perspective is created. If
- * an old perspective is restored from a persistence file then
- * this method is not called.
- *
- * @param factory the factory used to add views to the perspective
- */
- public void createInitialLayout(IPageLayout layout) {
- //layout.addView( MockViewPart.ID, IPageLayout.BOTTOM, 0.5f, layout.getEditorArea() );
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/FakeSelectionProvider.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/FakeSelectionProvider.java
deleted file mode 100644
index dbae25df5..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/FakeSelectionProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-/**
- * Serves up fake selections.
- *
- * Note: originally borrowed from org.eclipse.jdt.ui.tests.actions
- */
-public class FakeSelectionProvider implements ISelectionProvider {
- private Object[] fElems;
- public FakeSelectionProvider(Object[] elements){
- fElems = elements;
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- }
-
- public ISelection getSelection() {
- return new StructuredSelection(fElems);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- }
-
- public void setSelection(ISelection selection) {
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/GroupEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/GroupEntry.java
deleted file mode 100644
index 094558c6c..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/GroupEntry.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import org.xml.sax.Attributes;
-
-public class GroupEntry extends LogEntryContainer {
- public GroupEntry(LogEntryContainer parent, Attributes attributes) {
- this(parent, attributes.getValue("name"));
- }
-
- public GroupEntry(LogEntryContainer parent, String name) {
- super(parent, name);
- }
-
- public void accept(ILogEntryVisitor visitor) {
- visitor.visitGroupEntry(this);
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ICriteria.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ICriteria.java
deleted file mode 100644
index 3b84b7a67..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ICriteria.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-/**
- * Generic object filter mechanism.
- */
-public interface ICriteria {
- /**
- * Returns true if the candidate object satisfies the specified
- * criteria value according to a particular algorithm.
- */
- public boolean test(Object candidate, Object value);
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ILogEntryVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ILogEntryVisitor.java
deleted file mode 100644
index e9842b2c5..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/ILogEntryVisitor.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-public interface ILogEntryVisitor {
- public void visitRootEntry(RootEntry entry);
- public void visitCaseEntry(CaseEntry entry);
- public void visitGroupEntry(GroupEntry entry);
- public void visitTaskEntry(TaskEntry entry);
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntry.java
deleted file mode 100644
index 8e854ecd1..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntry.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-
-import junit.framework.Assert;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-public abstract class LogEntry {
- LogEntryContainer parent;
- String name;
-
- /**
- * Creates a new log entry with the specified parent.
- * @param parent the parent container
- * @param name the name of the entry
- */
- public LogEntry(LogEntryContainer parent, String name) {
- this.parent = parent;
- this.name = name != null ? name : "unknown";
- if (parent != null) parent.addEntry(this);
- }
-
- /**
- * Accepts a visitor.
- * @param visitor the visitor
- */
- public abstract void accept(ILogEntryVisitor visitor);
-
- /**
- * Returns the name of this entry.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the parent container of this entry, or null if none.
- */
- public LogEntryContainer getParent() {
- return parent;
- }
-
- /**
- * Reads an array of log entries from a file.
- * @return the log entries
- */
- public static RootEntry readLog(File file) throws IOException, SAXException {
- XMLReader reader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
- LogContentHandler contentHandler = new LogContentHandler();
- reader.setContentHandler(contentHandler);
- reader.parse(new InputSource(new FileInputStream(file)));
- return contentHandler.getLogEntries();
- }
-
- private static class LogContentHandler extends DefaultHandler implements ContentHandler {
- private RootEntry root = null;
- private LogEntry current = null;
-
- public RootEntry getLogEntries() {
- return root;
- }
- public void startElement(String uri, String localName, String qName, Attributes attributes)
- throws SAXException {
- if ("log".equals(localName)) {
- Assert.assertNull(current);
- current = root = new RootEntry(null, attributes);
- } else if ("case".equals(localName)) {
- Assert.assertNotNull(current);
- Assert.assertTrue(current instanceof RootEntry);
- current = new CaseEntry((LogEntryContainer) current, attributes);
- } else if ("group".equals(localName)) {
- Assert.assertNotNull(current);
- Assert.assertTrue(current instanceof CaseEntry || current instanceof GroupEntry);
- current = new GroupEntry((LogEntryContainer) current, attributes);
- } else if ("task".equals(localName)) {
- Assert.assertNotNull(current);
- Assert.assertTrue(current instanceof CaseEntry || current instanceof GroupEntry);
- current = new TaskEntry((LogEntryContainer) current, attributes);
- } else if ("result".equals(localName)) {
- Assert.assertNotNull(current);
- Assert.assertTrue(current instanceof TaskEntry);
- ((TaskEntry) current).addResult(new Result(attributes));
- } else if ("abort".equals(localName)) {
- // currently we ignore failure entries
- // XXX need a good way to represent failures
- } else if ("trace".equals(localName)) {
- // currently we ignore stack frames associated with failure entries
- } else if ("status".equals(localName)) {
- // currently we ignore status associated with failure entries
- } else {
- throw new SAXException("Unrecognized element: " + localName);
- }
- }
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
- Assert.assertNotNull(current);
- if ("result".equals(localName) || "abort".equals(localName) ||
- "trace".equals(localName) || "status".equals(localName)) {
- // nothing to do
- } else {
- current = current.getParent();
- }
- }
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntryContainer.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntryContainer.java
deleted file mode 100644
index aca48e393..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogEntryContainer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public abstract class LogEntryContainer extends LogEntry {
- private List /* of LogEntry */ list = new ArrayList();
-
- public LogEntryContainer(LogEntryContainer parent, String name) {
- super(parent, name);
- }
-
- /**
- * Accepts a visitor for each child in the order in which they are listed.
- * @param visitor the visitor
- */
- public void acceptChildren(ILogEntryVisitor visitor) {
- Iterator it = list.iterator();
- while (it.hasNext()) {
- LogEntry entry = (LogEntry) it.next();
- entry.accept(visitor);
- }
- }
-
- /**
- * Returns the list of children in this container.
- */
- public LogEntry[] members() {
- return (LogEntry[]) list.toArray(new LogEntry[list.size()]);
- }
-
- /**
- * Returns the member with the specified name and class.
- */
- public LogEntry findMember(String name, Class clazz) {
- Iterator it = list.iterator();
- while (it.hasNext()) {
- LogEntry entry = (LogEntry) it.next();
- if (name.equals(entry.getName()) &&
- clazz.isAssignableFrom(entry.getClass())) return entry;
- }
- return null;
- }
-
- /*
- * Adds the specified entry to the end of the list.
- */
- void addEntry(LogEntry entry) {
- list.add(entry);
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogFormatterUIMain.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogFormatterUIMain.java
deleted file mode 100644
index a7ce8a74c..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LogFormatterUIMain.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Quick and dirty UI frontend for the log formatters.
- */
-public class LogFormatterUIMain {
-
- public LogFormatterUIMain() {
- }
-
- public static void main(String[] args) {
- new LogFormatterUIMain().run();
- }
-
- public void run() {
- Display display = new Display();
- Shell shell = new Shell(display);
-
- shell.setText("Log Formatter UI");
- createContents(shell);
-
- shell.setSize(500, 300);
- shell.open();
- while (! shell.isDisposed()) {
- if (! display.readAndDispatch()) display.sleep();
- }
- shell.dispose();
- display.dispose();
- }
-
- protected void createContents(Composite parent) {
- parent.setLayout(new FillLayout());
- TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
- createSummaryTabContents(new TabItem(tabFolder, SWT.NONE));
- createDiffTabContents(new TabItem(tabFolder, SWT.NONE));
- }
-
- protected void createSummaryTabContents(TabItem item) {
- Composite top = new Composite(item.getParent(), SWT.NONE);
- item.setControl(top);
- item.setText("Create Log Summary");
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- top.setLayout(layout);
-
- final Text logFileText = createFileSelector(top, "Log file path: ");
- final Text outputFileText = createFileSelector(top, "Output file path: ");
-
- final Button csvCheckButton = new Button(top, SWT.CHECK);
- csvCheckButton.setText("Produce comma separated values data");
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 3;
- csvCheckButton.setLayoutData(data);
-
- final Button rawCheckButton = new Button(top, SWT.CHECK);
- rawCheckButton.setText("Do not merge results from successive iterations");
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 3;
- rawCheckButton.setLayoutData(data);
-
- createRunButton(top, new Runnable() {
- public void run() {
- PrintSummaryMain.main(new String[] {
- logFileText.getText(),
- "-out", outputFileText.getText(),
- csvCheckButton.getSelection() ? "-csv" : null,
- rawCheckButton.getSelection() ? "-raw" : null });
- }
- });
- }
-
- protected void createDiffTabContents(TabItem item) {
- Composite top = new Composite(item.getParent(), SWT.NONE);
- item.setControl(top);
- item.setText("Create Log Diff");
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- top.setLayout(layout);
-
- final Text newerLogFileText = createFileSelector(top, "Newer log file path: ");
- final Text olderLogFileText = createFileSelector(top, "Older log file path: ");
- final Text outputFileText = createFileSelector(top, "Output file path: ");
-
- Label label = new Label(top, SWT.NONE);
- label.setText("Threshold %");
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));
-
- final Text thresholdText = new Text(top, SWT.BORDER);
- thresholdText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
- thresholdText.setText("0");
-
- new Label(top, SWT.NONE);
-
- final Button csvCheckButton = new Button(top, SWT.CHECK);
- csvCheckButton.setText("Produce comma separated values data");
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 3;
- csvCheckButton.setLayoutData(data);
-
- final Button ignoreCheckButton = new Button(top, SWT.CHECK);
- ignoreCheckButton.setText("Ignore negligible changes in results");
- data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 3;
- ignoreCheckButton.setLayoutData(data);
-
- createRunButton(top, new Runnable() {
- public void run() {
- PrintDiffMain.main(new String[] {
- newerLogFileText.getText(),
- olderLogFileText.getText(),
- "-out", outputFileText.getText(),
- "-t", thresholdText.getText(),
- csvCheckButton.getSelection() ? "-csv" : null,
- ignoreCheckButton.getSelection() ? "-i" : null });
- }
- });
- }
-
- protected Text createFileSelector(Composite parent, String labelText) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(labelText);
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));
-
- final Text text = new Text(parent, SWT.BORDER);
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
-
- Button browseButton = new Button(parent, SWT.PUSH);
- browseButton.setText("Browse...");
- browseButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- FileDialog dialog = new FileDialog(text.getShell(), SWT.OPEN);
- dialog.setFileName(text.getText());
- String name = dialog.open();
- if (name != null) {
- text.setText(name);
- }
- }
- });
- browseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- return text;
- }
-
- protected Button createRunButton(Composite parent, final Runnable runnable) {
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_END | GridData.GRAB_VERTICAL);
- data.horizontalSpan = 3;
- separator.setLayoutData(data);
-
- final Button runButton = new Button(parent, SWT.PUSH);
- runButton.setText("Run");
- data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_FILL);
- data.horizontalSpan = 3;
- runButton.setLayoutData(data);
- runButton.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- runButton.getDisplay().asyncExec(runnable);
- }
- });
- return runButton;
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestCase.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestCase.java
deleted file mode 100644
index b5a389d20..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestCase.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestResult;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
-
-public class LoggingTestCase extends CVSTestSetup {
- private LoggingTestResult logResult;
- private int disableLogStack;
-
- /**
- * Creates a new logging test case.
- */
- public LoggingTestCase(Test test) {
- super(test);
- }
-
- /**
- * Runs a test.
- * @param result the result object
- */
- public void run(TestResult result) {
- // run the garbage collector now to improve benchmark precision
- for (int i = 0; i < 4; ++i) {
- System.runFinalization();
- System.gc();
- }
- if (result instanceof LoggingTestResult) {
- logResult = (LoggingTestResult) result;
- disableLogStack = 0;
- } else {
- logResult = null;
- disableLogStack = 1;
- }
- super.run(result);
- }
-
- /**
- * Marks the beginning of a new task group.
- * @param groupName the name for the group
- */
- protected void startGroup(String groupName) {
- if (disableLogStack == 0) logResult.startGroup(groupName);
- }
-
- /**
- * Marks the ends of the active task group.
- */
- protected void endGroup() {
- if (disableLogStack == 0) logResult.endGroup();
- }
-
- /**
- * Marks the beginning of a new task.
- * @param taskName the name for the task
- */
- protected void startTask(String taskName) {
- if (disableLogStack == 0) logResult.startTask(taskName);
- }
-
- /**
- * Marks the ends of the active task.
- */
- protected void endTask() {
- if (disableLogStack == 0) logResult.endTask();
- }
-
- /**
- * Disables logging until re-enabled. (this call nests)
- */
- protected void disableLog() {
- disableLogStack += 1;
- }
-
- /**
- * Enables logging when all previous calls to disableLog are matched.
- */
- protected void enableLog() {
- Assert.assertTrue(disableLogStack > 0);
- disableLogStack -= 1;
- Assert.assertTrue(disableLogStack != 0 || logResult != null);
- }
-
- /**
- * Prints a warning message to the log.
- * @param message the message, or null
- * @param error an exception with a stack trace, or null
- * @param status a status code, or null
- */
- protected void printWarning(String message, Throwable error, IStatus status) {
- if (disableLogStack == 0) logResult.printWarning(message, error, status);
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestResult.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestResult.java
deleted file mode 100644
index dad409d66..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestResult.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.PrintStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Stack;
-import java.util.StringTokenizer;
-
-import junit.framework.Assert;
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestResult;
-import junit.runner.BaseTestRunner;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.core.TeamException;
-
-public class LoggingTestResult extends TestResult {
- protected Stack groupStack;
- protected PerformanceTimer currentTask;
- protected PrintStream logStream;
- protected Stack /* of String */ elements;
- protected String indent;
-
- /**
- * Creates a logging test result.
- * @param logStream the output stream, or null to disable logging
- */
- public LoggingTestResult(PrintStream logStream) {
- this.logStream = logStream;
- this.elements = new Stack();
- this.indent = "";
- groupStack = new Stack();
- currentTask = null;
- }
-
- /**
- * Marks the beginning of a series of log entries.
- */
- public void startLog(long timestamp, String sdkBuild) {
- println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
- startXMLElement("log", new String[] { "timestamp", "sdkbuild" }, new String[] {
- new SimpleDateFormat("dd/MMM/yyyy HH:mm:ss").format(new Date(timestamp)),
- sdkBuild });
- }
-
- /**
- * Marks the end of a series of log entries.
- */
- public void endLog() {
- endXMLElement();
- }
-
- /**
- * Prints a warning message to the log file.
- * @param message the message, or null
- * @param error an exception with a stack trace, or null
- * @param status a status code, or null
- */
- public void printWarning(String message, Throwable error, IStatus status) {
- printAbort("warning", message, error, status);
- }
-
- /**
- * Called by the JUnit framework when an error occurs.
- * @param test the test
- * @param error the exception that occurred
- */
- public void addError(Test test, Throwable error) {
- printAbort("error", null, error, null);
- super.addError(test, error);
- }
-
- /**
- * Called by the JUnit framework when an assertion failure occurs.
- * @param test the test
- * @param error the exception that occurred
- */
- public void addFailure(Test test, AssertionFailedError error) {
- printAbort("failure", null, error, null);
- super.addFailure(test, error);
- }
-
- /**
- * Called by the JUnit framework to mark the beginning of a test case.
- * @param test the test
- */
- public void startTest(Test test) {
- if (test instanceof TestCase) {
- TestCase testCase = (TestCase) test;
- startXMLElement("case", new String[] { "class", "name" },
- new String[] { testCase.getClass().getName(), testCase.getName() });
- groupStack.clear();
- currentTask = null;
- }
- super.startTest(test);
- }
-
- /**
- * Called by the JUnit framework to mark the end of a test case.
- * @param test the test
- */
- public void endTest(Test test) {
- if (test instanceof TestCase) {
- TestCase testCase = (TestCase) test;
- if (currentTask != null) endTask();
- while (! groupStack.isEmpty()) endGroup();
- endXMLElement();
- }
- super.endTest(test);
- }
-
- /**
- * Marks the beginning of a new task group.
- * @param groupName the name for the group
- */
- public void startGroup(String groupName) {
- Assert.assertNull(currentTask);
- startXMLElement("group", new String[] { "name" }, new String[] { groupName });
- groupStack.push(groupName);
- }
-
- /**
- * Marks the end of the active task group.
- */
- public void endGroup() {
- Assert.assertNull(currentTask);
- Assert.assertTrue(! groupStack.empty());
- endXMLElement();
- groupStack.pop();
- }
-
- /**
- * Marks the beginning of a new task.
- * @param taskName the name for the task
- */
- public void startTask(String taskName) {
- Assert.assertNull(currentTask);
- startXMLElement("task", new String[] { "name" }, new String[] { taskName });
- currentTask = new PerformanceTimer(taskName);
- currentTask.start();
- }
-
- /**
- * Marks the end of the active task.
- */
- public void endTask() {
- Assert.assertNotNull(currentTask);
- currentTask.stop();
- printXMLElement("result", new String[] { "elapsed" },
- new String[] { Integer.toString(currentTask.getTotalMillis()) });
- endXMLElement();
- currentTask = null;
- }
-
- protected void startXMLElement(String name, String[] attributes, String[] values) {
- println(formatXMLElement(name, attributes, values, false));
- elements.push(name);
- indent += " ";
- }
-
- protected void printXMLElement(String name, String[] attributes, String[] values) {
- println(formatXMLElement(name, attributes, values, true));
- }
-
- protected String formatXMLElement(String name, String[] attributes, String[] values, boolean quickEnd) {
- // XXX need to escape certain characters in attribute values
- StringBuffer buffer = new StringBuffer("<");
- buffer.append(name);
- if (attributes != null && values != null) {
- for (int i = 0; i < attributes.length; ++i) {
- buffer.append(' ');
- buffer.append(attributes[i]);
- buffer.append("=\"");
- buffer.append(values[i]);
- buffer.append('"');
- }
- }
- if (quickEnd) buffer.append('/');
- buffer.append('>');
- return buffer.toString();
- }
-
- protected void endXMLElement() {
- indent = indent.substring(2);
- String name = (String) elements.pop();
- println("</" + name + ">");
- }
-
- protected void printXMLElementData(String line) {
- // XXX need to escape certain characters in element data
- println(line);
- }
-
- protected void printAbort(String type, String message, Throwable error, IStatus status) {
- if (status == null && error != null) {
- if (error instanceof CoreException) {
- status = ((CoreException) error).getStatus();
- } else if (error instanceof TeamException) {
- status = ((TeamException) error).getStatus();
- }
- }
- if (message == null && error != null) {
- message = error.getMessage();
- if (message == null) {
- message = error.getClass().getName();
- }
- }
- if (message == null && status != null) {
- message = status.getMessage();
- }
- if (message == null) message = "";
- startXMLElement("abort", new String[] { "type", "message" },
- new String[] { type, message });
- if (status != null) printStatus(status);
- if (error != null) printStackTrace(error);
- endXMLElement();
- }
-
- protected void printStatus(IStatus status) {
- startXMLElement("status", new String[] { "severity", "code", "plugin", "message" },
- new String[] {
- Integer.toString(status.getSeverity()),
- Integer.toString(status.getCode()),
- status.getPlugin(), status.getMessage() });
- if (status.isMultiStatus()) {
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; ++i) {
- printStatus(children[i]);
- }
- }
- endXMLElement();
- }
-
- protected void printStackTrace(Throwable error) {
- // XXX need a better way to serialize the stack trace
- String trace = BaseTestRunner.getFilteredTrace(error);
- StringTokenizer tok = new StringTokenizer(trace, "\r\n");
- if (! tok.hasMoreTokens()) return; // empty trace?
- tok.nextToken(); // skip message line
- startXMLElement("trace", null, null);
- while (tok.hasMoreTokens()) {
- String frame = tok.nextToken();
- printXMLElementData(frame);
- }
- endXMLElement();
- }
-
- protected void println(String line) {
- if (logStream != null) logStream.println(indent + line);
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestRunner.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestRunner.java
deleted file mode 100644
index 9d2e5714b..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/LoggingTestRunner.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import junit.framework.Test;
-import junit.framework.TestResult;
-import junit.textui.TestRunner;
-
-public class LoggingTestRunner extends TestRunner {
- protected LoggingTestResult logResult;
-
- protected TestResult createTestResult() {
- TestResult result = logResult;
- logResult = null;
- if (result == null) result = new LoggingTestResult(null);
- return result;
- }
-
- /**
- * Runs a logging test suite.
- * @param suite the test suite
- * @param logResult the result object to use, or null to create a new one
- * @param wait if true, pauses between test runs
- */
- public void doRun(Test suite, LoggingTestResult logResult, boolean wait) {
- this.logResult = logResult;
- super.doRun(suite, wait);
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/MergeRunsVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/MergeRunsVisitor.java
deleted file mode 100644
index 22b58dc46..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/MergeRunsVisitor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-public class MergeRunsVisitor implements ILogEntryVisitor {
- private RootEntry defaultRoot;
- private RootEntry root;
- private LogEntryContainer parent;
-
- /**
- * Creates a new visitor to merge series of log entries.
- * @param root the root of an existing log to merge into, or null
- */
- public MergeRunsVisitor(RootEntry root) {
- this.defaultRoot = root;
- this.parent = null;
- }
-
- /**
- * Returns the root of the newly merged log, or null if none.
- */
- public RootEntry getMergedRoot() {
- return root;
- }
-
- public void visitRootEntry(RootEntry entry) {
- root = defaultRoot;
- if (root == null) {
- root = new RootEntry(null, entry.getName(), entry.getSDKBuildId(), entry.getTimestamp());
- }
- parent = root;
- entry.acceptChildren(this);
- }
-
- public void visitCaseEntry(CaseEntry entry) {
- LogEntryContainer oldParent = parent;
- CaseEntry newEntry = (CaseEntry) parent.findMember(entry.getName(), CaseEntry.class);
- if (newEntry == null) {
- newEntry = new CaseEntry(parent, entry.getName(), entry.getClassName());
- }
- parent = newEntry;
- entry.acceptChildren(this);
- parent = oldParent;
- }
-
- public void visitGroupEntry(GroupEntry entry) {
- LogEntryContainer oldParent = parent;
- GroupEntry newEntry = (GroupEntry) parent.findMember(entry.getName(), GroupEntry.class);
- if (newEntry == null) {
- newEntry = new GroupEntry(parent, entry.getName());
- }
- parent = newEntry;
- entry.acceptChildren(this);
- parent = oldParent;
- }
-
- public void visitTaskEntry(TaskEntry entry) {
- TaskEntry newEntry = (TaskEntry) parent.findMember(entry.getName(), TaskEntry.class);
- if (newEntry == null) {
- newEntry = new TaskEntry(parent, entry.getName());
- }
- Result[] results = entry.getResults();
- for (int i = 0; i < results.length; i++) {
- newEntry.addResult(results[i]);
- }
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PerformanceTimer.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PerformanceTimer.java
deleted file mode 100644
index ddf7a359e..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PerformanceTimer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-public class PerformanceTimer {
- private long startTime;
- private int totalMillis;
- private String name;
-
- /**
- * Creates a timer, initially not running.
- */
- public PerformanceTimer(String name) {
- this.totalMillis = 0;
- this.name = name;
- }
-
- /**
- * Starts the timer. Timer must not be running.
- */
- public void start() {
- startTime = System.currentTimeMillis();
- }
-
- /**
- * Stops the timer. Timer must be running.
- */
- public void stop() {
- totalMillis += System.currentTimeMillis() - startTime;
- startTime = 0;
- }
-
- /**
- * Returns the total number of milliseconds elapsed over all measured intervals.
- */
- public int getTotalMillis() {
- return totalMillis;
- }
-
- /**
- * Returns the name of this timer.
- */
- public String getName() {
- return name;
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVDiffVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVDiffVisitor.java
deleted file mode 100644
index a05f9c0bb..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVDiffVisitor.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-public class PrintCSVDiffVisitor extends PrintDiffVisitor {
- private static final String GROUP_DELIMITER = " / ";
- private DelimitedValuesWriter writer;
- private String caseName;
- private String groupName;
-
- /**
- * Creates a diff visitor that generates CSV output.
- *
- * @param writer the delimited values writer
- * @see PrintDiffVisitor
- */
- public PrintCSVDiffVisitor(DelimitedValuesWriter writer, RootEntry olderRoot, int threshold, boolean ignoreNegligible) {
- super(olderRoot, threshold, ignoreNegligible);
- this.writer = writer;
- }
-
- protected void visitRootEntry(RootEntry entry, RootEntry olderEntry) {
- entry.acceptChildren(this);
- }
-
- protected void visitCaseEntry(CaseEntry entry, CaseEntry olderEntry) {
- caseName = entry.getName();
- groupName = null;
- entry.acceptChildren(this);
- }
-
- protected void visitGroupEntry(GroupEntry entry, GroupEntry olderEntry) {
- String oldGroupName = groupName;
- if (groupName == null) {
- groupName = entry.getName();
- } else {
- groupName += GROUP_DELIMITER + entry.getName();
- }
- entry.acceptChildren(this);
- groupName = oldGroupName;
- }
-
- protected void visitTaskEntry(TaskEntry entry, TaskEntry olderEntry) {
- writer.printFields(new String[] {
- caseName, // case
- groupName, // group
- entry.getName() // task
- });
- printTaskEntry(entry);
- printTaskEntry(olderEntry);
- if (entry.getTotalRuns() != 0 && olderEntry.getTotalRuns() != 0) {
- int olderMean = olderEntry.getAverageMillis();
- int diff = entry.getAverageMillis() - olderMean;
- if (isDifferenceUncertain(entry, olderEntry)) {
- writer.printField("UNCERTAIN");
- } else if (isDifferenceNegligible(entry, olderEntry)) {
- writer.printField("NEGLIGIBLE");
- } else {
- writer.printField(diff > 0 ? "SLOWER" : "FASTER"); // change type
- }
- writer.printField(Integer.toString(Math.abs(diff))); // change
- if (olderMean != 0) {
- writer.printField(Util.formatPercentageRatio(Math.abs(diff), olderMean)); // % change
- } else {
- writer.printField("");
- }
- } else {
- writer.printFields(new String[] { "", "", "" });
- }
- writer.endRecord();
- }
-
- protected void printTaskEntry(TaskEntry entry) {
- if (entry.getTotalRuns() != 0) {
- int mean = entry.getAverageMillis();
- writer.printFields(new String[] {
- Integer.toString(entry.getTotalRuns()), // runs
- Integer.toString(mean) // average
- });
- if (entry.getTotalRuns() > 1 && mean != 0) {
- int confidence = entry.getConfidenceInterval();
- writer.printFields(new String[] {
- Integer.toString(confidence), // 95% confidence interval
- Util.formatPercentageRatio(confidence, mean) // 95% c.i. as a percentage
- });
- } else {
- writer.printFields(new String[] { "", "" });
- }
- } else {
- writer.printFields(new String[] { "0", "", "", "" });
- }
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVSummaryVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVSummaryVisitor.java
deleted file mode 100644
index 1bde78ace..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintCSVSummaryVisitor.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-public class PrintCSVSummaryVisitor implements ILogEntryVisitor {
- private static final String GROUP_DELIMITER = " / ";
- private DelimitedValuesWriter writer;
- private String caseName;
- private String groupName;
-
- /**
- * Creates a visitor to print a log as comma-separated values.
- * @param writer the delimited values writer
- */
- public PrintCSVSummaryVisitor(DelimitedValuesWriter writer) {
- this.writer = writer;
- }
-
- public void visitRootEntry(RootEntry entry) {
- entry.acceptChildren(this);
- }
-
- public void visitCaseEntry(CaseEntry entry) {
- caseName = entry.getName();
- groupName = null;
- entry.acceptChildren(this);
- }
-
- public void visitGroupEntry(GroupEntry entry) {
- String oldGroupName = groupName;
- if (groupName == null) {
- groupName = entry.getName();
- } else {
- groupName += GROUP_DELIMITER + entry.getName();
- }
- entry.acceptChildren(this);
- groupName = oldGroupName;
- }
-
- public void visitTaskEntry(TaskEntry entry) {
- writer.printFields(new String[] {
- caseName, // case
- groupName, // group
- entry.getName() // task
- });
- if (entry.getTotalRuns() != 0) {
- int mean = entry.getAverageMillis();
- writer.printFields(new String[] {
- Integer.toString(entry.getTotalRuns()), // runs
- Integer.toString(mean) // average
- });
- if (entry.getTotalRuns() > 1 && mean != 0) {
- int confidence = entry.getConfidenceInterval();
- writer.printFields(new String[] {
- Integer.toString(confidence), // 95% confidence interval
- Util.formatPercentageRatio(confidence, mean) // 95% c.i. as a percentage
- });
- } else {
- writer.printFields(new String[] { "", "" });
- }
- } else {
- writer.printFields(new String[] { "0", "", "", "" });
- }
- // append the result fields (ms)
- Result[] results = entry.getResults();
- for (int i = 0; i < results.length; i++) {
- Result result = results[i];
- if (result.getRuns() == 0) continue;
- writer.printField(Integer.toString(result.getMillis() / result.getRuns()));
- }
- writer.endRecord();
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffMain.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffMain.java
deleted file mode 100644
index f4dfd60be..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffMain.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-
-import org.xml.sax.SAXException;
-
-public class PrintDiffMain {
- public static void main(String[] args) {
- Parser parser = new Parser();
- if (! parser.parse(args)) {
- System.err.println("Usage: <newer log> <older log> [-out <file>] [-csv] [-t <thresh>] [-i]");
- System.err.println(" -out <file> : specify the output file, default is console");
- System.err.println(" -csv : produce comma separated values data");
- System.err.println(" -t <thresh> : minimum non-negligible absolute % change");
- System.err.println(" -i : ignore negligible changes in results");
- return;
- }
- try {
- PrintStream ps = System.out;
- try {
- if (parser.outputFile != null) ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(parser.outputFile)));
- printDiff(ps, parser.newerLogFile, parser.olderLogFile, parser.csv, parser.thresh, parser.ignore);
- } finally {
- if (ps != System.out) ps.close();
- }
- } catch (Exception e) {
- System.err.println("An error occurred:");
- e.printStackTrace();
- return;
- }
- }
-
- private static void printDiff(PrintStream ps, File newerLogFile, File olderLogFile,
- boolean csv, int thresh, boolean ignore) throws IOException, SAXException {
- // read and merge newer log
- RootEntry newerRoot = LogEntry.readLog(newerLogFile);
- MergeRunsVisitor mergeVisitor = new MergeRunsVisitor(null);
- newerRoot.accept(mergeVisitor);
- newerRoot = mergeVisitor.getMergedRoot();
-
- // read and merge older log
- RootEntry olderRoot = LogEntry.readLog(olderLogFile);
- olderRoot.accept(mergeVisitor);
- olderRoot = mergeVisitor.getMergedRoot();
-
- // format options
- StringBuffer options = new StringBuffer();
- if (thresh != 0) {
- options.append("-t ");
- options.append(Integer.toString(thresh));
- options.append(" ");
- }
- if (ignore) options.append("-i ");
-
- // format log file
- if (csv) {
- DelimitedValuesWriter writer = new DelimitedValuesWriter(ps, ",", true /*quoted*/);
- // print header
- writer.printRecord(new String[] { "", "Newer", "Older" });
- writer.printRecord(new String[] { "Log File", newerLogFile.toString(), olderLogFile.toString() });
- writer.printRecord(new String[] { "Generated", newerRoot.getTimestamp(), olderRoot.getTimestamp() });
- writer.printRecord(new String[] { "SDK Build", newerRoot.getSDKBuildId(), olderRoot.getSDKBuildId() });
- writer.endRecord();
- writer.printRecord(new String[] { "Options", "'" + options.toString() });
- writer.endRecord();
- writer.printRecord(new String[] { "", "", "",
- "Newer", "", "", "",
- "Older", "", "", "",
- "", "", "" });
- writer.printRecord(new String[] { "Case", "Group", "Task",
- "Runs", "Avg. (ms)", "95% C.I. (ms)", "95% C.I. (%)",
- "Runs", "Avg. (ms)", "95% C.I. (ms)", "95% C.I. (%)",
- "Change", "Diff (ms)", "Diff (%)" });
- // print quoted CSV data
- PrintCSVDiffVisitor diffVisitor = new PrintCSVDiffVisitor(writer, olderRoot, thresh, ignore);
- newerRoot.accept(diffVisitor);
- } else {
- // print header
- ps.println("=== LOG DIFF ===");
- ps.println("Newer File: " + newerLogFile);
- ps.println(" Generated: " + newerRoot.getTimestamp());
- ps.println(" SDK Build: " + newerRoot.getSDKBuildId());
- ps.println("Older File: " + olderLogFile);
- ps.println(" Generated: " + olderRoot.getTimestamp());
- ps.println(" SDK Build: " + olderRoot.getSDKBuildId());
- ps.println("Options: " + options.toString());
- ps.println();
- // compute and print the differences
- PrintTextDiffVisitor diffVisitor = new PrintTextDiffVisitor(ps, olderRoot, thresh, ignore);
- newerRoot.accept(diffVisitor);
- }
- }
-
- private static class Parser extends ArgumentParser {
- public File newerLogFile = null;
- public File olderLogFile = null;
- public File outputFile = null;
- public boolean csv = false;
- public int thresh = 0;
- public boolean ignore = false;
-
- protected boolean handleFinished() {
- return newerLogFile != null && olderLogFile != null;
- }
- protected boolean handleArgument(int index, String arg) {
- if (index == 0) {
- newerLogFile = new File(arg);
- } else if (index == 1) {
- olderLogFile = new File(arg);
- } else {
- return false;
- }
- return true;
- }
- protected boolean handleOption(String option, String arg) {
- if ("-out".equals(option)) {
- if (arg == null) return false;
- outputFile = new File(arg);
- } else if ("-csv".equals(option)) {
- if (arg != null) return false;
- csv = true;
- } else if ("-t".equals(option)) {
- if (arg == null) return false;
- try {
- thresh = Integer.parseInt(arg, 10);
- } catch (NumberFormatException e) {
- return false;
- }
- if (thresh < 0) return false;
- } else if ("-i".equals(option)) {
- if (arg != null) return false;
- ignore = true;
- } else {
- return false;
- }
- return true;
- }
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffVisitor.java
deleted file mode 100644
index ab2d2443e..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintDiffVisitor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-public abstract class PrintDiffVisitor implements ILogEntryVisitor {
- protected RootEntry olderRoot;
- protected int threshold; // threshold for negligible changes
- protected boolean ignoreNegligible; // if true, ignores negligible changes
- protected LogEntryContainer olderParent; // corresponding parent in older root
-
- /**
- * Creates a visitor to print a summary of the changes between a log
- * and an older one. Optionally ignores differences within a certain threshold.
- * Does not print older entries for which there are no corresponding newer ones.
- *
- * @param olderRoot the root of the older log
- * @param threshold the minimum non-negligible % change
- * @param ignoreNegligible if true, does not display negligible changes
- */
- public PrintDiffVisitor(RootEntry olderRoot, int threshold, boolean ignoreNegligible) {
- this.olderRoot = olderRoot;
- this.olderParent = null;
- this.threshold = threshold;
- this.ignoreNegligible = ignoreNegligible;
- }
-
- protected abstract void visitRootEntry(RootEntry entry, RootEntry olderEntry);
- protected abstract void visitCaseEntry(CaseEntry entry, CaseEntry olderEntry);
- protected abstract void visitGroupEntry(GroupEntry entry, GroupEntry olderEntry);
- protected abstract void visitTaskEntry(TaskEntry entry, TaskEntry olderEntry);
-
- public void visitRootEntry(RootEntry entry) {
- olderParent = olderRoot;
- visitRootEntry(entry, olderRoot);
- }
-
- public void visitCaseEntry(CaseEntry entry) {
- LogEntryContainer prevOlderParent = olderParent;
- if (olderParent != null) {
- olderParent = (LogEntryContainer) olderParent.findMember(entry.getName(), CaseEntry.class);
- }
- visitCaseEntry(entry, (CaseEntry) olderParent);
- olderParent = prevOlderParent;
- }
-
- public void visitGroupEntry(GroupEntry entry) {
- LogEntryContainer prevOlderParent = olderParent;
- if (olderParent != null) {
- olderParent = (LogEntryContainer) olderParent.findMember(entry.getName(), GroupEntry.class);
- }
- visitGroupEntry(entry, (GroupEntry) olderParent);
- olderParent = prevOlderParent;
- }
-
- public void visitTaskEntry(TaskEntry entry) {
- TaskEntry olderEntry = null;
- if (olderParent != null) {
- olderEntry = (TaskEntry) olderParent.findMember(entry.getName(), TaskEntry.class);
- }
- if (ignoreNegligible && isDifferenceNegligible(entry, olderEntry)) return;
- visitTaskEntry(entry, olderEntry);
- }
-
- protected boolean isDifferenceNegligible(TaskEntry newerEntry, TaskEntry olderEntry) {
- if (newerEntry.getTotalRuns() == 0 || olderEntry.getTotalRuns() == 0) return false;
- int olderMean = olderEntry.getAverageMillis();
- if (olderMean == 0) return false;
- int newerMean = newerEntry.getAverageMillis();
- int diff = Math.abs(newerMean - olderMean);
- return diff * 100 / olderMean < threshold;
- }
-
- protected boolean isDifferenceUncertain(TaskEntry newerEntry, TaskEntry olderEntry) {
- if (newerEntry.getTotalRuns() == 0 || olderEntry.getTotalRuns() == 0) return false;
- int olderMean = olderEntry.getAverageMillis();
- int newerMean = newerEntry.getAverageMillis();
- int diff = Math.abs(newerMean - olderMean);
- int diffCI = newerEntry.getConfidenceInterval() + olderEntry.getConfidenceInterval();
- return diff < diffCI;
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintSummaryMain.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintSummaryMain.java
deleted file mode 100644
index fbdf96960..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintSummaryMain.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-
-import org.xml.sax.SAXException;
-
-public class PrintSummaryMain {
- public static void main(String[] args) {
- Parser parser = new Parser();
- if (! parser.parse(args)) {
- System.err.println("Usage: <log file> [-out <file>] [-csv] [-raw]");
- System.err.println(" -out <file> : specify the output file, default is console");
- System.err.println(" -csv : produce comma separated values data");
- System.err.println(" -raw : do not merge results from successive iterations");
- return;
- }
- try {
- PrintStream ps = System.out;
- try {
- if (parser.outputFile != null) ps = new PrintStream(new BufferedOutputStream(new FileOutputStream(parser.outputFile)));
- printLog(ps, parser.logFile, parser.csv, parser.raw);
- } finally {
- if (ps != System.out) ps.close();
- }
- } catch (Exception e) {
- System.err.println("An error occurred:");
- e.printStackTrace();
- return;
- }
- }
-
- private static void printLog(PrintStream ps, File logFile, boolean csv, boolean raw)
- throws IOException, SAXException {
- // read and merge the log
- RootEntry root = LogEntry.readLog(logFile);
- if (! raw) {
- MergeRunsVisitor mergeVisitor = new MergeRunsVisitor(null);
- root.accept(mergeVisitor);
- root = mergeVisitor.getMergedRoot();
- }
-
- // format options
- StringBuffer options = new StringBuffer();
- if (raw) options.append("-raw ");
-
- // format log file
- if (csv) {
- DelimitedValuesWriter writer = new DelimitedValuesWriter(ps, ",", true /*quoted*/);
- // print header
- writer.printRecord(new String[] { "Log File", logFile.toString() });
- writer.printRecord(new String[] { "Generated", root.getTimestamp() });
- writer.printRecord(new String[] { "SDK Build", root.getSDKBuildId() });
- writer.endRecord();
- writer.printRecord(new String[] { "Options", "'" + options.toString() });
- writer.endRecord();
- writer.printRecord(new String[] { "Case", "Group", "Task",
- "Runs", "Avg. (ms)", "95% C.I. (ms)", "95% C.I. (%)", "Results (ms)" });
- // print quoted CSV data
- PrintCSVSummaryVisitor visitor = new PrintCSVSummaryVisitor(writer);
- root.accept(visitor);
- } else {
- // print header
- ps.println("=== LOG SUMMARY ===");
- ps.println("File: " + logFile);
- ps.println(" Generated: " + root.getTimestamp());
- ps.println(" SDK Build: " + root.getSDKBuildId());
- ps.println("Options: " + options.toString());
- ps.println();
- // print the log summary
- root.accept(new PrintTextSummaryVisitor(ps));
- }
- }
-
- private static class Parser extends ArgumentParser {
- public File logFile = null;
- public File outputFile = null;
- public boolean csv = false;
- public boolean raw = false;
-
- protected boolean handleFinished() {
- return logFile != null;
- }
- protected boolean handleArgument(int index, String arg) {
- if (index == 0) {
- logFile = new File(arg);
- } else {
- return false;
- }
- return true;
- }
- protected boolean handleOption(String option, String arg) {
- if ("-out".equals(option)) {
- if (arg == null) return false;
- outputFile = new File(arg);
- } else if ("-csv".equals(option)) {
- if (arg != null) return false;
- csv = true;
- } else if ("-raw".equals(option)) {
- if (arg != null) return false;
- raw = true;
- } else {
- return false;
- }
- return true;
- }
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextDiffVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextDiffVisitor.java
deleted file mode 100644
index 4572a8734..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextDiffVisitor.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.PrintStream;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-public class PrintTextDiffVisitor extends PrintDiffVisitor {
- private PrintStream os;
- private List diffText; // list of things to print
- private String indent;
-
- /**
- * Creates a diff visitor that generates text output.
- *
- * @param os the output stream
- * @see PrintDiffVisitor
- */
- public PrintTextDiffVisitor(PrintStream os, RootEntry olderRoot, int threshold, boolean ignoreNegligible) {
- super(olderRoot, threshold, ignoreNegligible);
- this.os = os;
- this.diffText = null;
- this.indent = "";
- }
-
- protected void visitRootEntry(RootEntry entry, RootEntry olderEntry) {
- entry.acceptChildren(this);
- }
-
- protected void visitCaseEntry(CaseEntry entry, CaseEntry olderEntry) {
- String oldIndent = indent;
- indent += " ";
- StringBuffer line = new StringBuffer(indent);
- line.append("%%% ");
- line.append(entry.getName());
- line.append(", class=");
- line.append(entry.getClassName());
- line.append(':');
- os.println(line);
- diffText = null;
- entry.acceptChildren(this);
- if (diffText != null) {
- Iterator it = diffText.iterator();
- while (it.hasNext()) os.println((String) it.next());
- }
- diffText = null;
- os.println();
- indent = oldIndent;
- }
-
- protected void visitGroupEntry(GroupEntry entry, GroupEntry olderEntry) {
- String oldIndent = indent;
- List oldDiffText = diffText;
- indent += " ";
- diffText = null;
- entry.acceptChildren(this);
- indent = oldIndent;
- if (diffText != null) {
- StringBuffer line = new StringBuffer(indent);
- line.append("+ ");
- line.append(entry.getName());
- line.append(':');
- diffText.add(0, line.toString());
- if (oldDiffText != null) diffText.addAll(0, oldDiffText);
- } else {
- diffText = oldDiffText;
- }
- }
-
- protected void visitTaskEntry(TaskEntry entry, TaskEntry olderEntry) {
- // print task description
- if (diffText == null) diffText = new LinkedList(); // using a list for speedy prepending
- StringBuffer line = new StringBuffer(indent);
- line.append("- ");
- line.append(entry.getName());
- line.append(": ");
- diffText.add(line.toString());
-
- // print new entry performance
- printTaskEntry(" newer: ", entry);
-
- // print older entry performance
- if (olderEntry == null) return;
- printTaskEntry(" older: ", olderEntry);
-
- // print difference
- if (entry.getTotalRuns() == 0 || olderEntry.getTotalRuns() == 0) return;
- int olderMean = olderEntry.getAverageMillis();
- int diff = entry.getAverageMillis() - olderMean;
- line = new StringBuffer(indent);
- line.append(" diff : ");
-
- if (isDifferenceUncertain(entry, olderEntry)) {
- line.append("UNCERTAIN");
- } else if (isDifferenceNegligible(entry, olderEntry)) {
- line.append("NEGLIGIBLE");
- } else {
- line.append(diff > 0 ? "SLOWER" : "FASTER");
- line.append(" by ");
- line.append(Integer.toString(Math.abs(diff)));
- line.append(" ms");
- if (olderEntry.getAverageMillis() != 0) {
- line.append(" = ");
- line.append(Util.formatPercentageRatio(Math.abs(diff), olderMean));
- }
- line.append(" avg.");
- }
- diffText.add(line.toString());
- }
-
- protected void printTaskEntry(String prefix, TaskEntry task) {
- StringBuffer line = new StringBuffer(indent);
- line.append(prefix);
- if (task.getTotalRuns() != 0) {
- int averageTime = task.getAverageMillis();
- line.append(Integer.toString(averageTime));
- line.append(" ms");
- if (task.getTotalRuns() > 1) {
- line.append(" avg. over ");
- line.append(Integer.toString(task.getTotalRuns()));
- line.append(" runs");
- if (averageTime != 0) {
- int confidence = task.getConfidenceInterval();
- line.append(" (95% C.I. +/- ");
- line.append(Integer.toString(confidence));
- line.append(" ms = ");
- line.append(Util.formatPercentageRatio(confidence, averageTime));
- line.append(")");
- }
- }
- } else {
- line.append("skipped!");
- }
- diffText.add(line.toString());
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextSummaryVisitor.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextSummaryVisitor.java
deleted file mode 100644
index a2d91ab06..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/PrintTextSummaryVisitor.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.PrintStream;
-
-public class PrintTextSummaryVisitor implements ILogEntryVisitor {
- private PrintStream os;
- private String indent;
- private int totalAverageTime;
-
- /**
- * Creates a visitor to print a summary of all entries contained in a log.
- * @param os the output stream
- */
- public PrintTextSummaryVisitor(PrintStream os) {
- this.os = os;
- this.indent = "";
- this.totalAverageTime = 0;
- }
-
- protected void visitContainer(LogEntryContainer container) {
- int oldTotalAverageTime = totalAverageTime;
- indent += " ";
- container.acceptChildren(this);
- int averageTime = totalAverageTime - oldTotalAverageTime;
- StringBuffer line = new StringBuffer(indent);
- line.append("* total: ");
- line.append(Integer.toString(averageTime));
- line.append(" ms");
- os.println(line);
- indent = indent.substring(2);
- }
-
- /**
- * Prints the root entry information.
- */
- public void visitRootEntry(RootEntry entry) {
- entry.acceptChildren(this);
- }
-
- /**
- * Prints the total average time spent by all subgroups and subtasks.
- */
- public void visitCaseEntry(CaseEntry entry) {
- StringBuffer line = new StringBuffer(indent);
- line.append("%%% ");
- line.append(entry.getName());
- line.append(", class=");
- line.append(entry.getClassName());
- line.append(':');
- os.println(line);
- visitContainer(entry);
- os.println();
- }
-
- /**
- * Prints the total average time spent by all subtasks.
- */
- public void visitGroupEntry(GroupEntry entry) {
- StringBuffer line = new StringBuffer(indent);
- line.append("+ ");
- line.append(entry.getName());
- line.append(':');
- os.println(line);
- visitContainer(entry);
- }
-
- /**
- * Prints the average amount of time spent by a task.
- */
- public void visitTaskEntry(TaskEntry task) {
- StringBuffer line = new StringBuffer(indent);
- line.append("- ");
- line.append(task.getName());
- line.append(": ");
- if (task.getTotalRuns() != 0) {
- int averageTime = task.getAverageMillis();
- totalAverageTime += averageTime;
- line.append(Integer.toString(averageTime));
- line.append(" ms");
- if (task.getTotalRuns() > 1) {
- line.append(" avg. over ");
- line.append(Integer.toString(task.getTotalRuns()));
- line.append(" runs");
- if (averageTime != 0) {
- int confidence = task.getConfidenceInterval();
- line.append(" (95% C.I. +/- ");
- line.append(Integer.toString(confidence));
- line.append(" ms = ");
- line.append(Util.formatPercentageRatio(confidence, averageTime));
- line.append(")");
- }
- }
- } else {
- line.append("skipped!");
- }
- os.println(line);
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Result.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Result.java
deleted file mode 100644
index 0755d5e70..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Result.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import org.xml.sax.Attributes;
-
-/**
- * Holds the result of one iteration of tests.
- * Note that a test might be run multiple times per iteration, particularly if it
- * is of very short duration to reduce sampling error. This behaviour is not supported
- * at this time, but will likely be of value in the future.
- */
-public class Result {
- private int runs;
- private int millis;
-
- public Result(Attributes attributes) {
- this(1, Integer.parseInt(attributes.getValue("elapsed")));
- }
- public Result(int runs, int millis) {
- this.runs = runs;
- this.millis = millis;
- }
- public int getRuns() {
- return runs;
- }
- public int getMillis() {
- return millis;
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/RootEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/RootEntry.java
deleted file mode 100644
index 1d1452eb2..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/RootEntry.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import org.xml.sax.Attributes;
-
-public class RootEntry extends LogEntryContainer {
- private String sdkBuildId;
- private String timestamp;
-
- public RootEntry(LogEntryContainer parent, Attributes attributes) {
- this(parent, attributes.getValue("name"),
- attributes.getValue("sdkbuild"), attributes.getValue("timestamp"));
- }
-
- public RootEntry(LogEntryContainer parent, String name, String sdkBuildId, String timestamp) {
- super(parent, name);
- this.sdkBuildId = (sdkBuildId != null) ? sdkBuildId : "unknown";
- this.timestamp = (timestamp != null) ? timestamp : "unknown";
- }
-
- public void accept(ILogEntryVisitor visitor) {
- visitor.visitRootEntry(this);
- }
-
- /**
- * Returns the SDK Build id.
- */
- public String getSDKBuildId() {
- return sdkBuildId;
- }
-
- /**
- * Returns the class name of the test case.
- */
- public String getTimestamp() {
- return timestamp;
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SequenceGenerator.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SequenceGenerator.java
deleted file mode 100644
index 1b76b1a63..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SequenceGenerator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.util.Random;
-
-/**
- * Encapsulates algorithms and state for generating deterministic sequences.
- * The sequence of numbers generated will always follow the same pattern,
- * regardless of the time, place, or platform.
- */
-public class SequenceGenerator {
- private static long globalSeqNum = System.currentTimeMillis() * 1000;
- private final Random random;
- private int uniqueInt;
-
- /**
- * Constructs a new sequence generator with a known seed.
- */
- public SequenceGenerator() {
- random = new Random(3141592653589793238L); // a known constant
- uniqueInt = 1000000;
- }
-
- /**
- * Returns a globally unique long integer.
- */
- public static long nextGloballyUniqueLong() {
- return globalSeqNum++;
- }
-
- /**
- * Returns a unique 7-digit integer.
- */
- public int nextUniqueInt() {
- return uniqueInt++;
- }
-
- /**
- * Returns a pseudo-random integer between 0 and n-1.
- * @see Random#nextInt(int)
- */
- public int nextInt(int n) {
- return random.nextInt(n);
- }
-
- /**
- * Returns a pseudo-random real number following a gaussian distribution.
- * @see Random#nextGaussian()
- */
- public double nextGaussian() {
- return random.nextGaussian();
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SyncTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SyncTests.java
deleted file mode 100644
index a74b46604..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/SyncTests.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-
-public class SyncTests extends CVSUITestCase {
- private static final int FILE_SIZE_MEAN = 16384;
- private static final int FILE_SIZE_VARIANCE = 0;
- private static final int PROB_BINARY = 0;
-
- public SyncTests(Test test) {
- super(test);
- }
-
- public static Test suite() {
- return new BenchmarkTestSetup(new TestSuite(SyncTests.class));
- }
-
- public void testSync0() throws Exception {
- // test sync on project with no changes
- IProject project = setupOutProject();
- startGroup("test sync with no changes");
- syncCommitResources(new IResource[] { project }, null, "");
- endGroup();
- }
-
- public void testSync1() throws Exception {
- runTestSync(1);
- }
-
- public void testSync10() throws Exception {
- runTestSync(10);
- }
-
- public void testSync100() throws Exception {
- runTestSync(100);
- }
-
- protected IProject setupOutProject() throws Exception {
- IProject project = createAndImportProject("testSync", BenchmarkTestSetup.SMALL_ZIP_FILE);
- disableLog();
- actionShareProject(project);
- syncCommitResources(new IResource[] { project }, null, "initial");
- enableLog();
- return project;
- }
-
- /**
- * Runs a sequence of operations for the synchronizer tests.
- * A parallel project is used to generate incoming changes.
- */
- protected void runTestSync(int size) throws Exception {
- final SequenceGenerator gen = new SequenceGenerator();
-
- // setup out project then move it out of the way
- IProject outProject = setupOutProject();
- String moduleName = outProject.getName();
- Utils.renameResource(outProject, moduleName + "out");
- outProject = Utils.getProject(moduleName + "out");
-
- // setup in project
- disableLog();
- actionCheckoutProjects(new String[] { moduleName }, new CVSTag[] { new CVSTag() });
- enableLog();
- IProject inProject = Utils.getProject(moduleName);
-
- /*** outgoing and incoming changes ***/
- startGroup("synchronize " + size + " added file(s)");
- Utils.createRandomDeepFiles(gen, outProject, size, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY);
- startGroup("as outgoing changes");
- syncCommitResources(new IResource[] { outProject }, null, "");
- endGroup();
- startGroup("as incoming changes");
- syncUpdateResources(new IResource[] { inProject }, null);
- endGroup();
- endGroup();
-
- startGroup("synchronize " + size + " modified file(s)");
- Utils.modifyRandomDeepFiles(gen, outProject, size);
- startGroup("as outgoing changes");
- syncCommitResources(new IResource[] { outProject }, null, "");
- endGroup();
- startGroup("as incoming changes");
- syncUpdateResources(new IResource[] { inProject }, null);
- endGroup();
- endGroup();
-
- startGroup("synchronize " + size + " removed file(s)");
- Utils.deleteRandomDeepFiles(gen, outProject, size);
- startGroup("as outgoing changes");
- syncCommitResources(new IResource[] { outProject }, null, "");
- endGroup();
- startGroup("as incoming changes");
- syncUpdateResources(new IResource[] { inProject }, null);
- endGroup();
- endGroup();
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/TaskEntry.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/TaskEntry.java
deleted file mode 100644
index 666b40914..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/TaskEntry.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.xml.sax.Attributes;
-
-public class TaskEntry extends LogEntry {
- private List /* of Result */ results = new ArrayList();
-
- public TaskEntry(LogEntryContainer parent, Attributes attributes) {
- this(parent, attributes.getValue("name"));
- }
-
- public TaskEntry(LogEntryContainer parent, String name) {
- super(parent, name);
- }
-
- public void accept(ILogEntryVisitor visitor) {
- visitor.visitTaskEntry(this);
- }
-
- /**
- * Returns the average number of milliseconds elapsed, or -1 if unknown.
- */
- public int getAverageMillis() {
- int totalMillis = 0;
- int totalRuns = 0;
- for (Iterator it = results.iterator(); it.hasNext();) {
- Result result = (Result) it.next();
- totalMillis += result.getMillis();
- totalRuns += result.getRuns();
- }
- if (totalRuns == 0) return -1;
- return totalMillis / totalRuns;
- }
-
- /**
- * Returns the standard deviation of the sample.
- * sqrt((n * sum(X^2) - sum(X)^2) / (n * (n-1)))
- */
- public double getStandardDeviation() {
- double sumOfSquares = 0.0, sum = 0.0;
- int totalRuns = 0;
- for (Iterator it = results.iterator(); it.hasNext();) {
- Result result = (Result) it.next();
- if (result.getRuns() == 0) continue;
- totalRuns += result.getRuns();
- sum += result.getMillis();
- double average = (double)result.getMillis() / result.getRuns();
- sumOfSquares += average * average * result.getRuns();
- }
- if (totalRuns == 0) return 0;
- return Math.sqrt((sumOfSquares * totalRuns - sum * sum) / (totalRuns * (totalRuns - 1)));
- }
-
- /**
- * Returns a 95% confidence interval from the mean represented by getAverageMillis()
- * Uses the formula:
- * 1.960 * stdev() / sqrt(n)
- */
- public int getConfidenceInterval() {
- return (int) (1.960 * getStandardDeviation() / Math.sqrt(getTotalRuns()));
- }
-
- /**
- * Returns the number of times this task was run.
- */
- public int getTotalRuns() {
- int totalRuns = 0;
- for (Iterator it = results.iterator(); it.hasNext();) {
- Result result = (Result) it.next();
- totalRuns += result.getRuns();
- }
- return totalRuns;
- }
-
- /**
- * Returns an array of all Results for this task.
- */
- public Result[] getResults() {
- return (Result[]) results.toArray(new Result[results.size()]);
- }
-
- /**
- * Adds a result.
- * @param result the result
- */
- public void addResult(Result result) {
- results.add(result);
- }
-
-
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Util.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Util.java
deleted file mode 100644
index ac0f2bd75..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Util.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-
-public class Util {
- private static final NumberFormat percentageFormat = new DecimalFormat("####0.00%");
-
- public static String formatPercentageRatio(int numerator, int denominator) {
- return percentageFormat.format((double)numerator / denominator);
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Utils.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Utils.java
deleted file mode 100644
index 4ef55baba..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Utils.java
+++ /dev/null
@@ -1,774 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.*;
-import java.util.List;
-import java.util.zip.ZipException;
-import java.util.zip.ZipFile;
-
-import junit.framework.Assert;
-
-import org.eclipse.compare.structuremergeviewer.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ccvs.core.CVSStatus;
-import org.eclipse.ui.internal.ide.dialogs.InternalErrorDialog;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
-
-/**
- * Provides helpers for:
- * <ul>
- * <li>Resource manipulation</li>
- * <li>Diff trees</li>
- * <li>UI automation</li>
- * <li>Parallel development simulation</li>
- * </ul>
- *
- * Note: This class is referenced from the VCM 1.0 performance tests.
- */
-public class Utils {
- /*** RESOURCE MANIPULATION SUPPORT ***/
-
- /**
- * Gets a handle for a project of a given name.
- * @param name the project name
- * @return the project handle
- */
- public static IProject getProject(String name) throws CoreException {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
- }
-
- /**
- * Creates a new project.
- * @param name the project name
- * @return the project handle
- */
- public static IProject createProject(String name) throws CoreException {
- IProject project = getProject(name);
- if (!project.exists()) project.create(null);
- if (!project.isOpen()) project.open(null);
- return project;
- }
-
- /**
- * Deletes a project.
- * @param project the project
- */
- public static void deleteProject(IProject project) throws CoreException {
- project.delete(false /*force*/, null);
- }
-
- /**
- * Deletes a file and prunes empty containing folders.
- * @param file the file to delete
- */
- public static void deleteFileAndPrune(IFile file) throws CoreException {
- file.delete(false /*force*/, null);
- IContainer container = file.getParent();
- while (container != null && container instanceof IFolder &&
- isFolderEmpty((IFolder) container)) {
- deleteFolder((IFolder) container);
- container = container.getParent();
- }
- }
-
- /**
- * Deletes a folder.
- */
- public static void deleteFolder(IFolder folder) throws CoreException {
- try {
- folder.delete(false /*force*/, null);
- } catch (CoreException e) {
- IStatus status = e.getStatus();
- // ignore errors caused by attempting to delete folders that CVS needs to have around
- if (findStatusByCode(status, CVSStatus.FOLDER_NEEDED_FOR_FILE_DELETIONS) == null) {
- throw e;
- }
- }
- }
-
- /**
- * Finds an IStatus instance in a multi-status by status code.
- */
- public static IStatus findStatusByCode(IStatus status, int code) {
- if (status.getCode() == code) return status;
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- IStatus found = findStatusByCode(children[i], code);
- if (found != null) return found;
- }
- return null;
- }
-
- /**
- * Creates a uniquely named project.
- * @param prefix a string prepended to the generated name
- * @return the new project
- */
- public static IProject createUniqueProject(String prefix) throws CoreException {
- return createProject(makeUniqueName(null, prefix, null));
- }
-
- /**
- * Creates a uniquely named file in the parent folder or project with random contents.
- * @param gen the sequence generator
- * @param parent the parent IFolder or IProject for the new file
- * @param meanSize the mean size of file to create (in bytes)
- * @param variance 69% of files with be within this amount of the mean
- * @param probBinary the probability of a new file being binary as a percentage
- * @return the new file
- */
- public static IFile createUniqueFile(SequenceGenerator gen, IContainer parent,
- int meanSize, int variance, int probBinary) throws IOException, CoreException {
- int fileSize;
- do {
- fileSize = (int) Math.abs(gen.nextGaussian() * variance + meanSize);
- } while (fileSize > meanSize + variance * 4); // avoid huge files
-
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- String fileName;
- if (gen.nextInt(100) < probBinary) {
- fileName = makeUniqueName(gen, "file", "class"); // binary
- writeRandomBytes(gen, os, fileSize);
- } else {
- fileName = makeUniqueName(gen, "file", "txt"); // text
- writeRandomText(gen, os, fileSize);
- }
- IFile file = parent.getFile(new Path(fileName));
- file.create(new ByteArrayInputStream(os.toByteArray()), true, null);
- os.close();
- return file;
- }
-
- /**
- * Creates a uniquely named folder in the parent folder.
- * @param gen the sequence generator
- * @param parent the parent IFolder or IProject for the new folder
- * @return the new folder
- */
- public static IFolder createUniqueFolder(SequenceGenerator gen, IContainer parent) throws CoreException {
- IFolder folder = parent.getFolder(new Path(Utils.makeUniqueName(gen, "folder", null)));
- folder.create(false /*force*/, true /*local*/, null);
- return folder;
- }
-
- /**
- * Renames a resource.
- * The resource handle becomes invalid.
- * @param resource the existing resource
- * @param newName the new name for the resource
- */
- public static void renameResource(IResource resource, String newName) throws CoreException {
- switch (resource.getType()) {
- case IResource.PROJECT: {
- IProject project = (IProject) resource;
- IProjectDescription desc = project.getDescription();
- desc.setName(newName);
- project.move(desc, false /*force*/, true /*keepHistory*/, null);
- } break;
- case IResource.FOLDER: {
- try {
- resource.move(new Path(newName), false /*force*/, null);
- } catch (CoreException e) {
- IStatus status = e.getStatus();
- // ignore errors caused by attempting to delete folders that CVS needs to have around
- if (findStatusByCode(status, CVSStatus.FOLDER_NEEDED_FOR_FILE_DELETIONS) == null) {
- throw e;
- }
- }
- } break;
- default:
- resource.move(new Path(newName), false /*force*/, null);
- break;
- }
- }
-
- /**
- * Modified a resource.
- * @param gen the sequence generator
- * @param file the file to modify
- */
- public static void modifyFile(SequenceGenerator gen, IFile file)
- throws IOException, CoreException {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- try {
- InputStream is = file.getContents(true);
- try {
- byte[] buffer = new byte[8192];
- int rsize;
- boolean changed = false;
- while ((rsize = is.read(buffer)) != -1) {
- double gaussian;
- do {
- gaussian = gen.nextGaussian() * 0.5; // large changes are less likely than small ones
- } while (gaussian > 1.0 || gaussian < -1.0);
- int changeSize = (int) (gaussian * rsize);
- changed = changed || changeSize != 0;
- os.write(buffer, 0, changeSize < 0 ? - changeSize : rsize); // shrink file
- writeRandomText(gen, os, changeSize); // enlarge file
- }
- if (! changed) os.write('!'); // make sure we actually did change the file
- file.setContents(new ByteArrayInputStream(os.toByteArray()), false /*force*/, true /*keepHistory*/, null);
- } finally {
- is.close();
- }
- } finally {
- os.close();
- }
- }
-
- /**
- * Creates a unique name.
- * Ensures that a deterministic sequence of names is generated for all files
- * and folders within a project, though not across sessions.
- *
- * @param gen the generator, or null if this name is to be globally unique
- * @param prefix a string prepended to the generated name
- * @param extension the file extension not including the period, null if none
- * @return the new name
- */
- public static String makeUniqueName(SequenceGenerator gen, String prefix, String extension)
- throws CoreException {
- StringBuffer name = new StringBuffer(prefix);
- name.append('-');
- if (gen == null) {
- name.append(SequenceGenerator.nextGloballyUniqueLong());
- } else {
- name.append(gen.nextUniqueInt());
- }
- if (extension != null) {
- name.append('.');
- name.append(extension);
- }
- return name.toString();
- }
-
- /**
- * Imports a .zip file into a container's root folder.
- * @param container the container
- * @param file the path of the .zip file
- */
- public static void importZip(IContainer container, File file)
- throws IOException, ZipException, InterruptedException, InvocationTargetException {
- ZipFile zipFile = new ZipFile(file);
- ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile);
- ImportOperation importOperation = new ImportOperation(container.getFullPath(),
- provider.getRoot(), provider, null);
- importOperation.setOverwriteResources(true); // don't ask
- importOperation.run(new NullProgressMonitor());
- Assert.assertTrue(importOperation.getStatus().isOK());
- }
-
- /**
- * Writes random text to an output stream.
- * @param gen the sequence generator
- */
- public static void writeRandomText(SequenceGenerator gen, OutputStream os, int count) throws IOException {
- while (count-- > 0) {
- int c = gen.nextInt(99);
- os.write((c >= 95) ? '\n' : c + ' ');
- }
- }
-
- /**
- * Writes random bytes to an output stream.
- * @param gen the sequence generator
- */
- public static void writeRandomBytes(SequenceGenerator gen, OutputStream os, int count) throws IOException {
- while (count-- > 0) {
- os.write(gen.nextInt(256));
- }
- }
-
- /**
- * Creates a random folder deeply below the root folder.
- * @param gen the sequence generator
- * @param root the root IFolder or IProject for the operation
- * @return the new folder
- */
- public static IFolder createRandomDeepFolder(SequenceGenerator gen, IContainer root) throws CoreException {
- IContainer container = pickRandomDeepContainer(gen, root);
- for (;;) {
- IFolder folder = createUniqueFolder(gen, container);
- container = folder;
- // 12.5% chance of creating a nested folder
- if (gen.nextInt(8) != 0) return folder;
- }
- }
-
- /**
- * Creates several random files deeply below the root folder.
- * @param gen the sequence generator
- * @param root the root IFolder or IProject for the operation
- * @param count the number of files to create
- * @param meanSize the mean size of file to create (in bytes)
- * @param probBinary the probability of a new file being binary as a percentage
- */
- public static void createRandomDeepFiles(SequenceGenerator gen, IContainer root, int count,
- int meanSize, int variance, int probBinary) throws IOException, CoreException {
- while (count-- > 0) {
- createUniqueFile(gen, pickRandomDeepContainer(gen, root), meanSize, variance, probBinary);
- }
- }
-
- /**
- * Deletes several random files deeply below the root folder.
- * @param gen the sequence generator
- * @param root the root IFolder or IProject for the operation
- * @param count the number of files to delete
- */
- public static void deleteRandomDeepFiles(SequenceGenerator gen, IContainer root, int count) throws CoreException {
- while (count-- > 0) {
- IFile file = pickRandomDeepFile(gen, root);
- if (file == null) break;
- deleteFileAndPrune(file);
- }
- }
-
- /**
- * Modifies several random files deeply below the root folder.
- * @param gen the sequence generator
- * @param root the root IFolder or IProject for the operation
- * @param count the number of files to modify
- */
- public static void modifyRandomDeepFiles(SequenceGenerator gen, IContainer root, int count)
- throws IOException, CoreException {
- // perhaps we can add a parameter for the "magnitude" of the change
- while (count-- > 0) {
- IFile file = pickRandomDeepFile(gen, root);
- if (file == null) break;
- modifyFile(gen, file);
- }
- }
-
- /**
- * Touches several random files deeply below the root folder.
- * @param gen the sequence generator
- * @param root the root IFolder or IProject for the operation
- * @param count the number of files to touch
- */
- public static void touchRandomDeepFiles(SequenceGenerator gen, IContainer root, int count) throws CoreException {
- while (count-- > 0) {
- IFile file = pickRandomDeepFile(gen, root);
- if (file == null) break;
- file.touch(null);
- }
- }
-
- /**
- * Renames several random files deeply below the root folder.
- * @param gen the sequence generator
- * @param root the root IFolder or IProject for the operation
- * @param count the number of files to touch
- */
- public static void renameRandomDeepFiles(SequenceGenerator gen, IContainer root, int count) throws CoreException {
- IProject project = root.getProject();
- while (count-- > 0) {
- IFile file = pickRandomDeepFile(gen, root);
- if (file == null) break;
- renameResource(file, makeUniqueName(gen, "file", file.getFileExtension()));
- }
- }
-
- /**
- * Picks a random file from the parent folder or project.
- * @param gen the sequence generator
- * @param parent the parent IFolder or IProject for the operation
- * @return the file that was chosen, or null if no suitable files
- */
- public static IFile pickRandomFile(SequenceGenerator gen, IContainer parent) throws CoreException {
- IResource[] members = filterResources(parent.members());
- for (int size = members.length; size != 0; --size) {
- int elem = gen.nextInt(size);
- if (members[elem] instanceof IFile) return (IFile) members[elem];
- System.arraycopy(members, elem + 1, members, elem, size - elem - 1);
- }
- return null;
- }
-
- /**
- * Picks a random folder from the parent folder or project.
- * @param gen the sequence generator
- * @param parent the parent IFolder or IProject for the operation
- * @return the folder, or null if no suitable folders
- */
- public static IFolder pickRandomFolder(SequenceGenerator gen, IContainer parent) throws CoreException {
- IResource[] members = filterResources(parent.members());
- for (int size = members.length; size != 0; --size) {
- int elem = gen.nextInt(size);
- if (members[elem] instanceof IFolder) return (IFolder) members[elem];
- System.arraycopy(members, elem + 1, members, elem, size - elem - 1);
- }
- return null;
- }
-
- /**
- * Picks a random file deeply from the root folder or project.
- * @param gen the sequence generator
- * @param root the root IFolder or IProject for the operation
- * @return the file that was chosen, or null if no suitable files
- */
- public static IFile pickRandomDeepFile(SequenceGenerator gen, IContainer root) throws CoreException {
- IResource[] members = filterResources(root.members());
- for (int size = members.length; size != 0; --size) {
- int elem = gen.nextInt(size);
- IResource resource = members[elem];
- if (resource instanceof IFile) return (IFile) resource;
- if (resource instanceof IFolder) {
- IFile file = pickRandomDeepFile(gen, (IFolder) resource);
- if (file != null) return file;
- }
- System.arraycopy(members, elem + 1, members, elem, size - elem - 1);
- }
- return null;
- }
-
- /**
- * Picks a random folder deeply from the root folder or project.
- * May pick the project's root container.
- * @param gen the sequence generator
- * @param root the root IFolder or IProject for the operation
- * @return the container that was chosen, never null
- */
- public static IContainer pickRandomDeepContainer(SequenceGenerator gen, IContainer root) throws CoreException {
- if (gen.nextInt(6) == 0) {
- IResource[] members = filterResources(root.members());
- for (int size = members.length; size != 0; --size) {
- int elem = gen.nextInt(size);
- IResource resource = members[elem];
- if (resource instanceof IFolder) {
- return pickRandomDeepContainer(gen, (IFolder) resource);
- }
- System.arraycopy(members, elem + 1, members, elem, size - elem - 1);
- }
- }
- Assert.assertTrue(isValidContainer(root));
- return root;
- }
-
- /**
- * Returns true if the folder does not contain any real files.
- */
- public static boolean isFolderEmpty(IFolder folder) throws CoreException {
- IResource[] members = folder.members();
- for (int i = 0; i < members.length; ++i) {
- if (isValidFile(members[i]) || isValidFolder(members[i])) return false;
- }
- return true;
- }
-
- /**
- * Returns true iff file is a valid IFile (that should not be ignored).
- */
- public static boolean isValidFile(IResource file) throws CoreException {
- String name = file.getName();
- return file instanceof IFile
- && ! file.isPhantom()
- && ! name.equals(".classpath")
- && ! name.equals(".project")
- && ! name.equals(".vcm_meta");
- }
-
- /**
- * Returns true iff folder is a valid IFolder (that should not be ignored).
- */
- public static boolean isValidFolder(IResource folder) throws CoreException {
- String name = folder.getName();
- return folder instanceof IFolder
- && ! folder.isPhantom()
- && ! name.equals("CVS")
- && ! name.equals("bin");
- }
-
- /**
- * Returns true iff container is a valid IFolder or IProject (that should not be ignored).
- */
- public static boolean isValidContainer(IResource container) throws CoreException {
- return container instanceof IProject || isValidFolder(container);
- }
-
- /**
- * Returns true iff resource is a valid IFile, IFolder or IProject (that should not be ignored).
- */
- public static boolean isValidResource(IResource resource) throws CoreException {
- return isValidFile(resource) || isValidContainer(resource);
- }
-
- /**
- * Filters and sorts an array of resources to ensure deterministic behaviour across
- * sessions. The general idea is to guarantee that given a known sequence of
- * pseudo-random numbers, we will always pick the same sequence of files and
- * folders each time we repeat the test.
- */
- public static IResource[] filterResources(IResource[] resources) throws CoreException {
- List list = new ArrayList(resources.length);
- for (int i = 0; i < resources.length; ++i) {
- if (isValidResource(resources[i])) list.add(resources[i]);
- }
- if (list.size() != resources.length) {
- resources = (IResource[]) list.toArray(new IResource[list.size()]);
- }
- Arrays.sort(resources, new Comparator() {
- public int compare(Object a, Object b) {
- return ((IResource) a).getName().compareTo(((IResource) b).getName());
- }
- });
- return resources;
- }
-
- /*** DIFF SUPPORT ***/
-
- public static boolean isEmpty(IDiffContainer node) {
- if (node == null) return true;
- if (node.getKind() != 0) return false;
- IDiffElement[] children = node.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (!isEmpty(children[i])) return false;
- }
- return true;
- }
- public static boolean isEmpty(IDiffElement element) {
- if (element == null) return true;
- if (element.getKind() != 0) return false;
- if (element instanceof IDiffContainer) {
- IDiffElement[] children = ((DiffNode)element).getChildren();
- for (int i = 0; i < children.length; i++) {
- if (!isEmpty(children[i])) return false;
- }
- }
- return true;
- }
-
- /*** UI SUPPORT ***/
-
- /**
- * Opens the specified wizard, then notifies the waiter.
- * The WizardDialog instance is passed as argument to notify() in the waiter.
- */
- public static void waitForWizardToOpen(Shell parent, IWizard wizard, final Waiter waiter) {
- WizardDialog dialog = new WizardDialog(parent, wizard) {
- public int open() {
- // create the window's controls
- create();
- // hook into the event loop so we get called back when the wizard is up and running
- final Display display = getContents().getDisplay();
- final WizardDialog dialog = this;
- display.asyncExec(new Runnable() {
- public void run() {
- while (display.readAndDispatch()); // process any other pending messages first
- waiter.notify(dialog);
- }
- });
- // call open (does not create the window's controls a second time)
- return super.open();
- }
- };
- dialog.open();
- }
-
- /**
- * Notifies the waiter when a Shell matching the specified criteria opens.
- * The Shell instance is passed as argument to notify() in the waiter.
- *
- * @param display the root display
- * @param pollingPeriod the number of milliseconds to wait between polls
- * @param value a value used for matching
- * @param criteria a strategy for matching the controls with a value,
- * or null to match any Shell.
- * @param waiter the waiter to be notified
- */
- public static void waitForShellToOpen(final Display display, final int pollingPeriod,
- final Object value, final ICriteria criteria, final Waiter waiter) {
- final Runnable hook = new Runnable() {
- public void run() {
- if (display.isDisposed()) return;
- Shell[] shells = display.getShells();
- for (int i = 0; i < shells.length; ++i) {
- Shell shell = shells[i];
- if (criteria != null && ! criteria.test(shell, value)) continue;
- if (! waiter.notify(shell)) return;
- }
- // poll again as soon as possible
- if (waiter.keepWaiting()) {
- display.timerExec(pollingPeriod, this);
- }
- }
- };
- hook.run();
- }
-
-
- /**
- * Installs a watchdog for JFace error dialogs for the current display.
- * The Dialog instance is passed as argument to notify() in the waiter.
- * Recognized dialogs:
- * - ErrorDialog
- * - InternalErrorDialog
- *
- * @param display the root display
- * @param pollingPeriod the number of milliseconds to wait between polls
- * @param waiter the waiter to be notified
- */
- public static void waitForErrorDialog(Display display, int pollingPeriod, final Waiter waiter) {
- ICriteria criteria = new ICriteria() {
- public boolean test(Object candidate, Object value) {
- Shell shell = (Shell) candidate;
- if (shell.isDisposed()) return false;
- Object data = shell.getData();
- if (data == null) return false;
- return data instanceof ErrorDialog || data instanceof InternalErrorDialog;
- }
- };
- waitForShellToOpen(display, pollingPeriod, null, criteria, new Waiter() {
- public boolean keepWaiting() {
- return waiter.keepWaiting();
- }
-
- public boolean notify(Object object) {
- return waiter.notify(((Shell) object).getData());
- }
- });
- }
-
- /**
- * Finds a Control in a Composite hierarchy matching the specified criteria.
- *
- * @param root the root of the hierarchy to search
- * @param clazz the Class representing the precise type of Control to find
- * @param value a value used for matching
- * @param criteria a strategy for matching the controls with a value,
- * or null to match anything of the right class.
- * @return the first matching Control, or null if none found.
- */
- public static Control findControl(Composite root, Class clazz, Object value, ICriteria criteria) {
- if (clazz.isAssignableFrom(root.getClass())) {
- if (criteria == null || criteria.test(root, value)) return root;
- }
- Control[] children = root.getChildren();
- for (int i = 0; i < children.length; ++i) {
- final Control candidate = children[i];
- if (candidate instanceof Composite) {
- Control c = findControl((Composite) candidate, clazz, value, criteria);
- if (c != null) return c;
- } else {
- if (clazz.isAssignableFrom(candidate.getClass())) {
- if (criteria == null || criteria.test(candidate, value)) return candidate;
- }
- }
- }
- return null;
- }
-
- /**
- * Finds a Control in a Composite hierarchy with the specified text string.
- * Note: clazz must specify a Control subclass that defines getText()
- *
- * @param root the root of the hierarchy to search
- * @param clazz the Class representing the precise type of Control to find
- * @param text the text string to find
- * @return the first matching Control, or null if none found.
- */
- public static Control findControlWithText(Composite root, Class clazz, String text) {
- return findControl(root, clazz, text, new ICriteria() {
- public boolean test(Object control, Object value) {
- // getText is only defined on certain subclasses of Composite
- // so we must use reflection to find the method
- try {
- Method m = control.getClass().getMethod("getText", new Class[0]);
- String text = (String) m.invoke(control, new Object[0]);
- return value.equals(stripMnemonicEscapes(text));
- } catch (Exception e) {
- e.printStackTrace();
- Assert.fail("Could not invoke method getText()");
- }
- return false;
- }
- });
- }
-
- /**
- * Posts a fake event to the queue.
- * Fills in the event type and widget fields.
- * @param event the Event
- */
- public static void postEvent(final Widget widget, final int eventType, final Event event) {
- Display display = widget.getDisplay();
- event.type = eventType;
- event.widget = widget;
- display.asyncExec(new Runnable() {
- public void run() {
- widget.notifyListeners(eventType, event);
- }
- });
- }
-
- /**
- * Strips mnemonic escapes from a text label.
- */
- public static String stripMnemonicEscapes(String label) {
- StringBuffer buf = new StringBuffer();
- int length = label.length();
- for (int i = 0; i < length; ++i) {
- char c = label.charAt(i);
- if (c == '&') {
- i += 1;
- if (i < length) c = label.charAt(i);
- }
- buf.append(c);
- }
- return buf.toString();
- }
-
- /**
- * Process pending events for the current display, until at least the
- * specified number of milliseconds elapses.
- */
- public static void processEventsUntil(int hiatus) {
- Display display = Display.getCurrent();
- Assert.assertNotNull(display);
- final boolean done[] = new boolean[] { hiatus == 0 };
- if (hiatus != 0) display.timerExec(hiatus, new Runnable() {
- public void run() { done[0] = true; }
- });
- for (;;) {
- while (display.readAndDispatch());
- if (done[0]) return;
- display.sleep();
- }
- }
-
- /**
- * Process pending events for the current display, until resumed by the user.
- * Very useful for inspecting intermediate results while debugging.
- */
- public static void processEventsUntilResumed(String title) {
- Display display = Display.getCurrent();
- Assert.assertNotNull(display);
- Shell shell = new Shell(display, SWT.CLOSE);
- shell.setText("Close me to resume: " + title);
- shell.setBounds(0, 0, 500, 30);
- shell.open();
- while (! shell.isDisposed()) {
- while (! display.readAndDispatch()) display.sleep();
- }
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Waiter.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Waiter.java
deleted file mode 100644
index 91dd75672..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/Waiter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-
-/**
- * Abstract listener used for the generic problem of waiting for
- * something to happen and retrieving some related information.
- * e.g. Waiting for a window with a given title to open and getting its handle.
- */
-public abstract class Waiter {
- /**
- * Called when the desired event has occurred.
- * @param object an object related to the event, type depends on the context
- * @return true to keep waiting, otherwise false
- */
- public abstract boolean notify(Object object);
-
- /**
- * Called after each unsuccessful poll for the event.
- * @return true to keep waiting, otherwise false
- */
- public boolean keepWaiting() {
- return true;
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/WorkflowTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/WorkflowTests.java
deleted file mode 100644
index e5fee208a..000000000
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/old/WorkflowTests.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.tests.ccvs.ui.old;
-
-
-import java.io.File;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-
-public class WorkflowTests extends CVSUITestCase {
- private int FILE_SIZE_MEAN = 16384;
- private int FILE_SIZE_VARIANCE = 12288;
- private int PROB_BINARY = 5;
- public WorkflowTests(Test test) {
- super(test);
- }
-
- public static Test suite() {
- return new BenchmarkTestSetup(new TestSuite(WorkflowTests.class));
- //return new BenchmarkTestSetup(new WorkflowTests("testTinyWorkflow"));
- }
-
- public void testBigWorkflow() throws Exception {
- runWorkflowTests("testBig", BenchmarkTestSetup.BIG_ZIP_FILE);
- }
-
- public void testSmallWorkflow() throws Exception {
- runWorkflowTests("testSmall", BenchmarkTestSetup.SMALL_ZIP_FILE);
- }
-
- public void testTinyWorkflow() throws Exception {
- runWorkflowTests("testTiny", BenchmarkTestSetup.TINY_ZIP_FILE);
- }
-
- /**
- * Runs a series of incoming and outgoing workflow-related tests.
- */
- protected void runWorkflowTests(String name, File initialContents) throws Exception {
- final SequenceGenerator gen = new SequenceGenerator();
- IProject outProject = createAndImportProject(name, initialContents);
-
- // test project sharing
- startGroup("test project sharing");
- actionShareProject(outProject);
- endGroup();
-
- // test initial project commit
- startGroup("test initial project commit");
- syncCommitResources(new IResource[] { outProject }, null, "initial");
- endGroup();
-
- // move the project out of the way
- String moduleName = outProject.getName();
- Utils.renameResource(outProject, moduleName + "out");
- outProject = Utils.getProject(moduleName + "out");
-
- // test initial project checkout
- startGroup("test initial project checkout");
- actionCheckoutProjects(new String[] { moduleName }, new CVSTag[] { new CVSTag() });
- endGroup();
- IProject inProject = Utils.getProject(moduleName);
-
- // test scenarios
- startGroup("test incoming and outgoing change scenarios");
- startGroup("adding a new component - localized additions and some changes");
- Utils.modifyRandomDeepFiles(gen, outProject, 5);
- Utils.touchRandomDeepFiles(gen, outProject, 2);
- IFolder componentRoot = Utils.createRandomDeepFolder(gen, outProject);
- Utils.createRandomDeepFiles(gen, componentRoot, 12, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY);
- syncCommitResources(new IResource[] { outProject }, null, "");
- endGroup();
-
- startGroup("catching up to a new component - localized additions and some changes");
- syncUpdateResources(new IResource[] { inProject }, null);
- endGroup();
-
- startGroup("fixing a bug - localized changes");
- Utils.modifyRandomDeepFiles(gen, componentRoot, 2);
- Utils.touchRandomDeepFiles(gen, componentRoot, 2);
- syncCommitResources(new IResource[] { outProject }, null, "");
- endGroup();
-
- startGroup("catching up to a bug fix - localized changes");
- syncUpdateResources(new IResource[] { inProject }, null);
- endGroup();
-
- startGroup("moving a package - scattered changes, files moved");
- Utils.modifyRandomDeepFiles(gen, outProject, 5); // a few scattered changes
- Utils.modifyRandomDeepFiles(gen, componentRoot, 12); // changes to "package" stmt
- Utils.renameResource(componentRoot, Utils.makeUniqueName(gen, "folder", null));
- syncCommitResources(new IResource[] { outProject }, null, "");
- endGroup();
-
- startGroup("catching up to a moved package - scattered changes, files moved");
- syncUpdateResources(new IResource[] { inProject }, null);
- endGroup();
-
- startGroup("big refactoring - scattered changes, files renamed and balanced additions/deletions");
- Utils.deleteRandomDeepFiles(gen, outProject, 4); // some stuff deleted
- Utils.modifyRandomDeepFiles(gen, outProject, 20); // many scattered changes
- Utils.renameRandomDeepFiles(gen, outProject, 5); // renamed some stuff
- Utils.createRandomDeepFiles(gen, outProject, 4, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY); // some new stuff added
- syncCommitResources(new IResource[] { outProject }, null, "");
- endGroup();
-
- startGroup("catching up to a big refactoring - scattered changes, files renamed and balanced additions/deletions");
- syncUpdateResources(new IResource[] { inProject }, null);
- endGroup();
- endGroup();
-
- // test tagging a project
- startGroup("tag project");
- actionCVSTag(new IResource[] { outProject }, "v101");
- endGroup();
-
- // replace with remote contents
- startGroup("test replace with remote contents scenarios");
- startGroup("no local dirty files, no remote changes");
- actionReplaceWithRemote(new IResource[] { inProject });
- endGroup();
-
- startGroup("abandoning some local work, no remote changes");
- Utils.deleteRandomDeepFiles(gen, inProject, 4); // some stuff locally deleted
- Utils.modifyRandomDeepFiles(gen, inProject, 6); // a few unimportant changes to forget
- Utils.createRandomDeepFiles(gen, inProject, 4, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY); // some new work to abandon
- actionReplaceWithRemote(new IResource[] { inProject });
- endGroup();
-
- startGroup("no local dirty files, many remote changes");
- // e.g. returning from a long vacation
- Utils.deleteRandomDeepFiles(gen, outProject, 10); // some components obsoleted
- Utils.modifyRandomDeepFiles(gen, outProject, 42); // many changes
- Utils.renameRandomDeepFiles(gen, outProject, 8); // evidence of some refactoring
- Utils.createRandomDeepFiles(gen, outProject, 10, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY); // a few new components added
- disableLog();
- syncCommitResources(new IResource[] { outProject }, null, "");
- enableLog();
- actionReplaceWithRemote(new IResource[] { inProject });
- endGroup();
- endGroup();
- }
-}
diff --git a/tests/org.eclipse.team.tests.cvs.core/toc.xml b/tests/org.eclipse.team.tests.cvs.core/toc.xml
index c7dbb75e7..83848af71 100644
--- a/tests/org.eclipse.team.tests.cvs.core/toc.xml
+++ b/tests/org.eclipse.team.tests.cvs.core/toc.xml
@@ -60,5 +60,17 @@
<topic label="General use" href="html/00032.html">
</topic>
</topic>
+ <topic label="Annotate" href="html/00033.html">
+ <topic label="Show Annotation Action" href="html/00034.html">
+ </topic>
+ </topic>
+ <topic label="Label Decorations" href="html/00035.html">
+ <topic label="Enablement at startup" href="html/00036.html">
+ </topic>
+ <topic label="Customizations" href="html/00037.html">
+ </topic>
+ <topic label="Decorations in the Synchronize pages" href="html/00038.html">
+ </topic>
+ </topic>
</topic>
</toc>

Back to the top