1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
package org.eclipse.team.tests.ccvs.ui.benchmark;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
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.core.runtime.Path;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.tests.ccvs.ui.CVSUITestCase;
import org.eclipse.team.tests.ccvs.ui.LoggingTestResult;
import org.eclipse.team.tests.ccvs.ui.SequenceGenerator;
import org.eclipse.team.tests.ccvs.ui.Util;
public class WorkflowTests extends CVSUITestCase {
private int FILE_SIZE_MEAN = 16384;
private int FILE_SIZE_VARIANCE = 12288;
private int PROB_BINARY = 5;
public WorkflowTests(String name) {
super(name);
}
public WorkflowTests() {
super("");
}
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();
Util.renameResource(outProject, moduleName + "out");
outProject = Util.getProject(moduleName + "out");
// test initial project checkout
startGroup("test initial project checkout");
actionCheckoutProjects(new String[] { moduleName }, new CVSTag[] { new CVSTag() });
endGroup();
IProject inProject = Util.getProject(moduleName);
// test scenarios
startGroup("test incoming and outgoing change scenarios");
startGroup("adding a new component - localized additions and some changes");
Util.modifyRandomDeepFiles(gen, outProject, 5);
Util.touchRandomDeepFiles(gen, outProject, 2);
IFolder componentRoot = Util.createRandomDeepFolder(gen, outProject);
Util.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");
Util.modifyRandomDeepFiles(gen, componentRoot, 2);
Util.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");
Util.modifyRandomDeepFiles(gen, outProject, 5); // a few scattered changes
Util.modifyRandomDeepFiles(gen, componentRoot, 12); // changes to "package" stmt
Util.renameResource(componentRoot, Util.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");
Util.deleteRandomDeepFiles(gen, outProject, 4); // some stuff deleted
Util.modifyRandomDeepFiles(gen, outProject, 20); // many scattered changes
Util.renameRandomDeepFiles(gen, outProject, 5); // renamed some stuff
Util.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");
Util.deleteRandomDeepFiles(gen, inProject, 4); // some stuff locally deleted
Util.modifyRandomDeepFiles(gen, inProject, 6); // a few unimportant changes to forget
Util.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
Util.deleteRandomDeepFiles(gen, outProject, 10); // some components obsoleted
Util.modifyRandomDeepFiles(gen, outProject, 42); // many changes
Util.renameRandomDeepFiles(gen, outProject, 8); // evidence of some refactoring
Util.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();
}
}
|