Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2011-01-04 09:27:01 -0500
committerTomasz Zarna2011-01-04 09:27:01 -0500
commita2f709414c0ad5d447974868bf1318d0bcadac37 (patch)
tree3a2fe0df367106c1c8260eaa8aeb329700722b4e
parent2c43312024a2788938f1f0f0110cc2fd483651ed (diff)
downloadeclipse.platform.team-a2f709414c0ad5d447974868bf1318d0bcadac37.tar.gz
eclipse.platform.team-a2f709414c0ad5d447974868bf1318d0bcadac37.tar.xz
eclipse.platform.team-a2f709414c0ad5d447974868bf1318d0bcadac37.zip
bug 315694: Team > Merge operation for project contains logical model always show no changes between two branches (performance test)
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SubscriberParticipantSyncInfoSource.java37
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java11
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/MergeTests.java99
3 files changed, 135 insertions, 12 deletions
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SubscriberParticipantSyncInfoSource.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SubscriberParticipantSyncInfoSource.java
index 1413c286d..aec94f0db 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SubscriberParticipantSyncInfoSource.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/SubscriberParticipantSyncInfoSource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,19 +20,38 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.*;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.ui.subscriber.*;
+import org.eclipse.team.core.synchronize.SyncInfo;
+import org.eclipse.team.core.synchronize.SyncInfoTree;
+import org.eclipse.team.internal.ccvs.core.CVSCompareSubscriber;
+import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.ui.subscriber.CompareParticipant;
+import org.eclipse.team.internal.ccvs.ui.subscriber.MergeSynchronizeParticipant;
+import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
import org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector;
import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.synchronize.*;
+import org.eclipse.team.internal.ui.synchronize.AbstractSynchronizeModelProvider;
+import org.eclipse.team.internal.ui.synchronize.SubscriberParticipantPage;
+import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
+import org.eclipse.team.internal.ui.synchronize.SynchronizeModelManager;
+import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
+import org.eclipse.team.internal.ui.synchronize.SynchronizeView;
+import org.eclipse.team.internal.ui.synchronize.TreeViewerAdvisor;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.*;
+import org.eclipse.team.ui.synchronize.ISynchronizeManager;
+import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
+import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference;
+import org.eclipse.team.ui.synchronize.ISynchronizeView;
+import org.eclipse.team.ui.synchronize.SubscriberParticipant;
+import org.eclipse.team.ui.synchronize.WorkspaceScope;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.IPage;
@@ -153,8 +172,8 @@ public class SubscriberParticipantSyncInfoSource extends ParticipantSyncInfoSour
/* (non-Javadoc)
* @see org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource#createMergeSubscriber(org.eclipse.core.resources.IProject, org.eclipse.team.internal.ccvs.core.CVSTag, org.eclipse.team.internal.ccvs.core.CVSTag)
*/
- public CVSMergeSubscriber createMergeSubscriber(IProject project, CVSTag root, CVSTag branch) {
- CVSMergeSubscriber mergeSubscriber = super.createMergeSubscriber(project, root, branch);
+ public CVSMergeSubscriber createMergeSubscriber(IProject project, CVSTag root, CVSTag branch, boolean isModelSync) {
+ CVSMergeSubscriber mergeSubscriber = super.createMergeSubscriber(project, root, branch, isModelSync);
SubscriberParticipant participant = new MergeSynchronizeParticipant(mergeSubscriber);
showParticipant(participant);
return mergeSubscriber;
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java
index c7e79d084..141332348 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/BenchmarkUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -333,12 +333,17 @@ public class BenchmarkUtils {
* @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
+ * @return the created files
+ * @throws IOException
+ * @throws CoreException
*/
- public static void createRandomDeepFiles(SequenceGenerator gen, IContainer root, int count,
+ public static IFile[] createRandomDeepFiles(SequenceGenerator gen, IContainer root, int count,
int meanSize, int variance, int probBinary) throws IOException, CoreException {
+ IFile[] files = new IFile[count];
while (count-- > 0) {
- createUniqueFile(gen, pickRandomDeepContainer(gen, root), meanSize, variance, probBinary);
+ files[count] = createUniqueFile(gen, pickRandomDeepContainer(gen, root), meanSize, variance, probBinary);
}
+ return files;
}
/**
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/MergeTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/MergeTests.java
new file mode 100644
index 000000000..df9ee884a
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/benchmark/MergeTests.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ccvs.ui.benchmark;
+
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.internal.ccvs.core.CVSMergeSubscriber;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.tests.ccvs.core.subscriber.SyncInfoSource;
+import org.eclipse.team.tests.ccvs.ui.SubscriberParticipantSyncInfoSource;
+
+/**
+ * The test performed by this class is used to compare the performance of the
+ * merge with and without the fix introduced in bug 315694.
+ * <p>
+ * When {@link CVSMergeSubscriber} is created with <code>isModelSync</code> flag
+ * set to <code>true</code>, which takes place when <code>MODEL_MERGE</code>
+ * group is started, the subscriber will *not* ignore outgoing changes during a
+ * merge. For more details see bug 315694.
+ */
+public class MergeTests extends BenchmarkTest {
+
+ private static final String NON_MODEL_MERGE = "NonModelMerge";
+ private static final String MODEL_MERGE = "ModelMerge";
+
+ private static final String[] PERFORMANCE_GROUPS = new String[] { NON_MODEL_MERGE, MODEL_MERGE };
+
+ private static final int FILE_SIZE_MEAN = 16384;
+ private static final int FILE_SIZE_VARIANCE = 0;
+ private static final int PROB_BINARY = 0;
+
+ public MergeTests() {
+ super();
+ }
+
+ public MergeTests(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return suite(MergeTests.class);
+ }
+
+ protected IProject setupProject() throws Exception {
+ IProject project = createUniqueProject(BenchmarkTestSetup.SMALL_ZIP_FILE);
+ shareProject(project);
+ return project;
+ }
+
+ public void testCompareMerges() throws Exception {
+ openEmptyPerspective();
+ setupGroups(PERFORMANCE_GROUPS, "Merge Tests", false);
+ System.out.println("Loop: " + BenchmarkTestSetup.LOOP_COUNT);
+ for (int i = 0; i < BenchmarkTestSetup.LOOP_COUNT; i++) {
+ final SequenceGenerator gen = new SequenceGenerator();
+
+ IProject headProject = setupProject();
+ CVSTag root = new CVSTag("Root_branch", CVSTag.BRANCH);
+ CVSTag branch = new CVSTag("branch", CVSTag.BRANCH);
+ makeBranch(new IResource[] {headProject}, root, branch, false);
+ IProject branchProject = checkoutCopy(headProject, branch);
+
+ SyncInfoSource source = new SubscriberParticipantSyncInfoSource();
+ int size = 50;
+ BenchmarkUtils.deleteRandomDeepFiles(gen, branchProject, size);
+ BenchmarkUtils.modifyRandomDeepFiles(gen, branchProject, size);
+ IResource[] newResources = BenchmarkUtils.createRandomDeepFiles(gen, branchProject, size, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY);
+ addResources(newResources);
+ syncCommitResources(source, new IResource[] { branchProject }, "");
+
+ BenchmarkUtils.deleteRandomDeepFiles(gen, headProject, size);
+ BenchmarkUtils.modifyRandomDeepFiles(gen, headProject, size);
+ BenchmarkUtils.createRandomDeepFiles(gen, headProject, size, FILE_SIZE_MEAN, FILE_SIZE_VARIANCE, PROB_BINARY);
+
+ startGroup(NON_MODEL_MERGE);
+ CVSMergeSubscriber subscriber = source.createMergeSubscriber(headProject, CVSTag.DEFAULT, branch, false);
+ source.refresh(subscriber, headProject);
+ endGroup();
+
+ startGroup(MODEL_MERGE);
+ subscriber = source.createMergeSubscriber(headProject, CVSTag.DEFAULT, branch, true);
+ source.refresh(subscriber, headProject);
+ endGroup();
+
+ System.out.println(i + 1);
+ }
+ commitGroups(false);
+ }
+}

Back to the top