KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > cvsmodule > StandardWorkFlow


1 /*
2  * StandardWorkFlow.java
3  *
4  * Created on 26 October 2005, 19:34
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9 package org.netbeans.test.cvsmodule;
10
11 import java.io.BufferedReader JavaDoc;
12 import java.io.File JavaDoc;
13 import java.io.FileReader JavaDoc;
14 import java.io.InputStream JavaDoc;
15 import javax.swing.ListModel JavaDoc;
16 import javax.swing.table.TableModel JavaDoc;
17 import junit.textui.TestRunner;
18 import org.netbeans.jellytools.EditorOperator;
19 import org.netbeans.jellytools.JellyTestCase;
20 import org.netbeans.jellytools.NbDialogOperator;
21 import org.netbeans.jellytools.OutputOperator;
22 import org.netbeans.jellytools.OutputTabOperator;
23 import org.netbeans.jellytools.ProjectsTabOperator;
24 import org.netbeans.jellytools.modules.javacvs.BranchOperator;
25 import org.netbeans.jellytools.modules.javacvs.CVSRootStepOperator;
26 import org.netbeans.jellytools.modules.javacvs.CheckoutWizardOperator;
27 import org.netbeans.jellytools.modules.javacvs.CommitOperator;
28 import org.netbeans.jellytools.modules.javacvs.DiffOperator;
29 import org.netbeans.jellytools.modules.javacvs.ModuleToCheckoutStepOperator;
30 import org.netbeans.jellytools.modules.javacvs.SearchHistoryOperator;
31 import org.netbeans.jellytools.modules.javacvs.SwitchToBranchOperator;
32 import org.netbeans.jellytools.modules.javacvs.VersioningOperator;
33 import org.netbeans.jellytools.nodes.Node;
34 import org.netbeans.jellytools.nodes.SourcePackagesNode;
35 import org.netbeans.jemmy.JemmyProperties;
36 import org.netbeans.jemmy.QueueTool;
37 import org.netbeans.jemmy.TimeoutExpiredException;
38 import org.netbeans.jemmy.operators.JButtonOperator;
39 import org.netbeans.jemmy.operators.JListOperator;
40 import org.netbeans.jemmy.operators.JProgressBarOperator;
41 import org.netbeans.jemmy.operators.JTableOperator;
42 import org.netbeans.jemmy.operators.JTextFieldOperator;
43 import org.netbeans.jemmy.operators.Operator;
44 import org.netbeans.jemmy.operators.Operator.DefaultStringComparator;
45 import org.netbeans.junit.NbTestSuite;
46 import org.netbeans.junit.ide.ProjectSupport;
47
48 /**
49  *
50  * @author peter
51  */

52 public class StandardWorkFlow extends JellyTestCase {
53     
54     String JavaDoc os_name;
55     static String JavaDoc sessionCVSroot;
56     final String JavaDoc projectName = "ForImport";
57     final String JavaDoc pathToMain = "forimport|Main.java";
58     final String JavaDoc PROTOCOL_FOLDER = "protocol";
59     static File JavaDoc cacheFolder;
60     Operator.DefaultStringComparator comOperator;
61     Operator.DefaultStringComparator oldOperator;
62     
63     /**
64      * Creates a new instance of CheckOutWizardTest
65      */

66     public StandardWorkFlow(String JavaDoc name) {
67         super(name);
68     }
69     
70     /**
71      * @param args the command line arguments
72      */

73     public static void main(String JavaDoc[] args) {
74         // TODO code application logic here
75
TestRunner.run(suite());
76     }
77     
78      public static NbTestSuite suite() {
79         NbTestSuite suite = new NbTestSuite();
80         suite.addTest(new StandardWorkFlow("testCheckOutProject"));
81         suite.addTest(new StandardWorkFlow("testIgnoreUnignoreFile"));
82         suite.addTest(new StandardWorkFlow("testIgnoreUnignoreGuiForm"));
83         suite.addTest(new StandardWorkFlow("testCommit"));
84         suite.addTest(new StandardWorkFlow("testCreateBranchForProject"));
85         suite.addTest(new StandardWorkFlow("testSwitchProjectToBranch"));
86         suite.addTest(new StandardWorkFlow("testDiffFile"));
87         suite.addTest(new StandardWorkFlow("testExportDiffPatch"));
88         suite.addTest(new StandardWorkFlow("testResolveConflicts"));
89         suite.addTest(new StandardWorkFlow("testRevertModifications"));
90         suite.addTest(new StandardWorkFlow("testShowAnnotations"));
91         suite.addTest(new StandardWorkFlow("testSearchHistory"));
92         suite.addTest(new StandardWorkFlow("testVersioningButtons"));
93         suite.addTest(new StandardWorkFlow("testRemoveFileGetBack"));
94         suite.addTest(new StandardWorkFlow("testRemoveFileCommit"));
95         suite.addTest(new StandardWorkFlow("removeAllData"));
96         return suite;
97      }
98      
99     protected void setUp() throws Exception JavaDoc {
100         
101         os_name = System.getProperty("os.name");
102         //System.out.println(os_name);
103
System.out.println("### "+getName()+" ###");
104         
105     }
106     
107     protected boolean isUnix() {
108         boolean unix = false;
109         if (os_name.indexOf("Windows") == -1) {
110             unix = true;
111         }
112         return unix;
113     }
114     
115     public void testCheckOutProject() throws Exception JavaDoc {
116         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
117
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
118
OutputOperator oo = OutputOperator.invoke();
119         comOperator = new Operator.DefaultStringComparator(true, true);
120         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
121         Operator.setDefaultStringComparator(comOperator);
122         CheckoutWizardOperator cwo = CheckoutWizardOperator.invoke();
123         Operator.setDefaultStringComparator(oldOperator);
124         CVSRootStepOperator crso = new CVSRootStepOperator();
125         //JComboBoxOperator combo = new JComboBoxOperator(crso, 0);
126
crso.setCVSRoot(":pserver:anoncvs@localhost:/cvs");
127         //crso.setPassword("");
128
//crso.setPassword("test");
129

130         //prepare stream for successful authentification and run PseudoCVSServer
131
InputStream JavaDoc in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "authorized.in");
132         PseudoCvsServer cvss = new PseudoCvsServer(in);
133         new Thread JavaDoc(cvss).start();
134         cvss.ignoreProbe();
135         String JavaDoc CVSroot = cvss.getCvsRoot();
136         sessionCVSroot = CVSroot;
137         //System.out.println(sessionCVSroot);
138
crso.setCVSRoot(CVSroot);
139         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
140         crso.next();
141               
142         try {
143            JProgressBarOperator progress = new JProgressBarOperator(crso);
144            JButtonOperator btnStop = new JButtonOperator(crso);
145         } catch (TimeoutExpiredException e) {
146             throw e;
147         }
148         
149         //second step of checkoutwizard
150
//2nd step of CheckOutWizard
151

152         File JavaDoc tmp = new File JavaDoc("/tmp"); // NOI18N
153
File JavaDoc work = new File JavaDoc(tmp, "" + File.separator + System.currentTimeMillis());
154         cacheFolder = new File JavaDoc(work, projectName + File.separator + "src" + File.separator + "forimport" + File.separator + "CVS" + File.separator + "RevisionCache");
155         tmp.mkdirs();
156         work.mkdirs();
157         tmp.deleteOnExit();
158         ModuleToCheckoutStepOperator moduleCheck = new ModuleToCheckoutStepOperator();
159         cvss.stop();
160         in.close();
161         moduleCheck.setModule("ForImport");
162         moduleCheck.setLocalFolder(work.getAbsolutePath()); // NOI18N
163

164         //Pseudo CVS server for finishing check out wizard
165
in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "checkout_finish_2.in");
166         cvss = new PseudoCvsServer(in);
167         new Thread JavaDoc(cvss).start();
168         CVSroot = cvss.getCvsRoot();
169         //cvss.ignoreProbe();
170

171         //crso.setCVSRoot(CVSroot);
172
//combo.setSelectedItem(CVSroot);
173
System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
174         cwo.finish();
175         
176         //System.out.println(CVSroot);
177

178         OutputTabOperator oto = new OutputTabOperator(sessionCVSroot);
179         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
180         oto.waitText("Checking out finished");
181         cvss.stop();
182         in.close();
183         NbDialogOperator nbdialog = new NbDialogOperator("Checkout Completed");
184         JButtonOperator open = new JButtonOperator(nbdialog, "Open Project");
185         open.push();
186         
187         ProjectSupport.waitScanFinished();
188         new QueueTool().waitEmpty(1000);
189         ProjectSupport.waitScanFinished();
190         
191         //create new elements for testing
192
TestKit.createNewElements(projectName);
193         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
194     }
195     
196     public void testIgnoreUnignoreFile() throws Exception JavaDoc{
197         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 3000);
198
VersioningOperator vo;
199         //OutputOperator oo;
200
OutputTabOperator oto;
201         InputStream JavaDoc in;
202         PseudoCvsServer cvss;
203         String JavaDoc CVSroot;
204         JTableOperator table;
205         org.openide.nodes.Node nodeIDE;
206         String JavaDoc color;
207        
208         Node nodeClass = new Node(new SourcePackagesNode(projectName), "xx|NewClass.java");
209         nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
210         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
211         assertEquals("Wrong color for new file", TestKit.NEW_COLOR, color);
212         
213         //show changes stream for pseudocvsserver
214
//oo = OutputOperator.invoke();
215
//System.out.println(sessionCVSroot);
216
oto = new OutputTabOperator(sessionCVSroot);
217         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
218         oto.clear();
219         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "show_changes_for_file");
220         cvss = new PseudoCvsServer(in);
221         new Thread JavaDoc(cvss).start();
222         CVSroot = cvss.getCvsRoot();
223         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
224         nodeClass.performPopupAction("CVS|Show Changes");
225         Thread.sleep(1000);
226         vo = VersioningOperator.invoke();
227         table = vo.tabFiles();
228         //System.out.println(""+table);
229
oto.waitText("Refreshing CVS Status finished");
230         Thread.sleep(1000);
231         assertEquals("Wrong row count of table.", 1, table.getRowCount());
232         assertEquals("Wrong file listed in table.", "NewClass.java", table.getValueAt(0, 0).toString());
233         cvss.stop();
234         
235         //ignore java file
236
//oo = OutputOperator.invoke();
237
oto = new OutputTabOperator(sessionCVSroot);
238         oto.clear();
239         nodeClass.performPopupAction("CVS|Ignore");
240         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "show_changes_for_file");
241         cvss = new PseudoCvsServer(in);
242         new Thread JavaDoc(cvss).start();
243         CVSroot = cvss.getCvsRoot();
244         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
245         //nodeClass.performPopupAction("CVS|Show Changes");
246

247         Thread.sleep(1000);
248         assertEquals("File should not be listed in table", 0, table.getRowCount());
249         cvss.stop();
250         
251         nodeClass = new Node(new SourcePackagesNode(projectName), "xx|NewClass.java");
252         nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
253         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
254         assertEquals("Wrong color for new file", TestKit.IGNORED_COLOR, color);
255         
256         //unignore java file
257
//oo = OutputOperator.invoke();
258
//oto = oo.getOutputTab(sessionCVSroot);
259
oto.clear();
260         nodeClass.performPopupAction("CVS|Unignore");
261         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "show_changes_for_file");
262         cvss = new PseudoCvsServer(in);
263         new Thread JavaDoc(cvss).start();
264         CVSroot = cvss.getCvsRoot();
265         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
266         nodeClass.performPopupAction("CVS|Show Changes");
267         oto.waitText("Refreshing CVS Status finished");
268         Thread.sleep(1000);
269         assertEquals("File should not be listed in table", 1, table.getRowCount());
270         cvss.stop();
271        
272         nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
273         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
274         assertEquals("Wrong color for new file", TestKit.NEW_COLOR, color);
275         
276         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
277     }
278     
279     public void testIgnoreUnignoreGuiForm() throws Exception JavaDoc{
280         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 3000);
281
VersioningOperator vo;
282         //OutputOperator oo;
283
OutputTabOperator oto;
284         InputStream JavaDoc in;
285         PseudoCvsServer cvss;
286         String JavaDoc CVSroot;
287         JTableOperator table;
288         org.openide.nodes.Node nodeIDE;
289         String JavaDoc color;
290         Object JavaDoc[] expected;
291         Object JavaDoc[] actual;
292        
293         Node nodeFrame = new Node(new SourcePackagesNode(projectName), "xx|NewJFrame.java");
294         nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
295         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
296         assertEquals("Wrong color for new file", TestKit.NEW_COLOR, color);
297         
298         //show changes stream for pseudocvsserver
299
//oo = OutputOperator.invoke();
300
//System.out.println(sessionCVSroot);
301
oto = new OutputTabOperator(sessionCVSroot);
302         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
303         oto.clear();
304         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "show_changes_for_jframe");
305         cvss = new PseudoCvsServer(in);
306         new Thread JavaDoc(cvss).start();
307         CVSroot = cvss.getCvsRoot();
308         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
309         nodeFrame.performPopupAction("CVS|Show Changes");
310         Thread.sleep(1000);
311         vo = VersioningOperator.invoke();
312         table = vo.tabFiles();
313         //System.out.println(""+table);
314
oto.waitText("Refreshing CVS Status finished");
315         Thread.sleep(1000);
316         //assertEquals("Wrong row count of table.", 1, table.getRowCount());
317
//assertEquals("Wrong file listed in table.", "NewClass.java", table.getValueAt(0, 0).toString());
318
cvss.stop();
319         TableModel JavaDoc model = table.getModel();
320   
321         expected = new String JavaDoc[] {"NewJFrame.form", "NewJFrame.java"};
322         actual = new String JavaDoc[model.getRowCount()];
323         for (int i = 0; i < actual.length; i++) {
324             actual[i] = model.getValueAt(i, 0).toString();
325         }
326         int result = TestKit.compareThem(expected, actual, false);
327         assertEquals("Wrong files in view", 2, result);
328         
329         //ignore java file
330
//oo = OutputOperator.invoke();
331
//oto = oo.getOutputTab(sessionCVSroot);
332
oto = new OutputTabOperator(sessionCVSroot);
333         oto.clear();
334         nodeFrame.performPopupAction("CVS|Ignore");
335         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "show_changes_for_jframe");
336         cvss = new PseudoCvsServer(in);
337         new Thread JavaDoc(cvss).start();
338         CVSroot = cvss.getCvsRoot();
339         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
340         //nodeFrame.performPopupAction("CVS|Show Changes");
341

342         Thread.sleep(1000);
343         assertEquals("File should not be listed in table", 0, table.getRowCount());
344         cvss.stop();
345         
346         nodeFrame = new Node(new SourcePackagesNode(projectName), "xx|NewJFrame.java");
347         nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
348         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
349         assertEquals("Wrong color for new file", TestKit.IGNORED_COLOR, color);
350         
351         //unignore java file
352
//oo = OutputOperator.invoke();
353
//oto = oo.getOutputTab(sessionCVSroot);
354
oto = new OutputTabOperator(sessionCVSroot);
355         oto.clear();
356         nodeFrame.performPopupAction("CVS|Unignore");
357         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "show_changes_for_jframe");
358         cvss = new PseudoCvsServer(in);
359         new Thread JavaDoc(cvss).start();
360         CVSroot = cvss.getCvsRoot();
361         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
362         nodeFrame.performPopupAction("CVS|Show Changes");
363         oto.waitText("Refreshing CVS Status finished");
364         Thread.sleep(1000);
365         assertEquals("File should not be listed in table", 2, table.getRowCount());
366         cvss.stop();
367        
368         nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
369         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
370         assertEquals("Wrong color for new file", TestKit.NEW_COLOR, color);
371         
372         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
373     }
374     
375     public void testCommit() throws Exception JavaDoc {
376         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
377
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 18000);
378
PseudoCvsServer cvss, cvss2, cvss3, cvss4;
379         InputStream JavaDoc in, in2, in3, in4;
380         CommitOperator co;
381         String JavaDoc CVSroot, color;
382         JTableOperator table;
383         //OutputOperator oo;
384
OutputTabOperator oto;
385         VersioningOperator vo;
386         String JavaDoc[] expected;
387         String JavaDoc[] actual;
388         String JavaDoc allCVSRoots;
389         org.openide.nodes.Node nodeIDE;
390         
391         oto = new OutputTabOperator(sessionCVSroot);
392         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
393         
394         Node packNode = new Node(new SourcePackagesNode("ForImport"), "xx");
395         //
396
Node nodeClass = new Node(new SourcePackagesNode("ForImport"), "xx|NewClass.java");
397         nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
398         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
399         assertEquals("Wrong color for new file", TestKit.NEW_COLOR, color);
400         //
401

402         Node nodeFrame = new Node(new SourcePackagesNode("ForImport"), "xx|NewJFrame.java");
403         nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
404         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
405         assertEquals("Wrong color for new file", TestKit.NEW_COLOR, color);
406         //
407

408         co = CommitOperator.invoke(packNode);
409         Thread.sleep(1000);
410         table = co.tabFiles();
411         TableModel JavaDoc model = table.getModel();
412         
413         expected = new String JavaDoc[] {"NewClass.java", "NewJFrame.form", "NewJFrame.java"};
414         actual = new String JavaDoc[model.getRowCount()];
415         for (int i = 0; i < actual.length; i++) {
416             actual[i] = model.getValueAt(i, 0).toString();
417         }
418         int result = TestKit.compareThem(expected, actual, false);
419         assertEquals("Wrong records displayed in dialog", 3, result);
420         co.setCommitMessage("Initial commit message");
421         
422         //oo = OutputOperator.invoke();
423

424         //oto.clear();
425
in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "commit_invoke.in");
426         cvss = new PseudoCvsServer(in);
427         new Thread JavaDoc(cvss).start();
428         allCVSRoots = cvss.getCvsRoot() + ",";
429      
430         in2 = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "commit_invoke_add.in");
431         cvss2 = new PseudoCvsServer(in2);
432         new Thread JavaDoc(cvss2).start();
433         allCVSRoots = allCVSRoots + cvss2.getCvsRoot() + ",";
434         
435         in3 = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "commit_invoke_commit.in");
436         cvss3 = new PseudoCvsServer(in3);
437         new Thread JavaDoc(cvss3).start();
438         allCVSRoots = allCVSRoots + cvss3.getCvsRoot() + ",";
439         
440         in4 = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "checkout_final.in");
441         cvss4 = new PseudoCvsServer(in4);
442         new Thread JavaDoc(cvss4).start();
443         allCVSRoots = allCVSRoots + cvss4.getCvsRoot();
444         
445         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", allCVSRoots);
446         co.commit();
447         oto.waitText("Committing \"xx\" finished");
448         
449         cvss.stop();
450         cvss2.stop();
451         cvss3.stop();
452         cvss4.stop();
453         
454         nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
455         //color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
456
assertNull("Wrong color of node!!!", nodeIDE.getHtmlDisplayName());
457         
458         nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
459         assertNull("Wrong color of node!!!", nodeIDE.getHtmlDisplayName());
460         
461         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
462     }
463     
464     public void testDiffFile() throws Exception JavaDoc {
465         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
466
PseudoCvsServer cvss;
467         InputStream JavaDoc in;
468         //OutputOperator oo;
469
OutputTabOperator oto;
470         org.openide.nodes.Node nodeIDE;
471         String JavaDoc color;
472         
473         oto = new OutputTabOperator(sessionCVSroot);
474         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
475         
476         Node node = new Node(new SourcePackagesNode(projectName), pathToMain);
477         node.performPopupAction("Open");
478         EditorOperator eo = new EditorOperator("Main.java");
479         eo.deleteLine(2);
480         eo.insert(" insert", 5, 1);
481         eo.insert("\tSystem.out.println(\"\");\n", 19, 1);
482         eo.save();
483         
484         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "diff_class.in");
485         cvss = new PseudoCvsServer(in);
486         new Thread JavaDoc(cvss).start();
487         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
488         node.performPopupAction("CVS|Diff...");
489         //oo = OutputOperator.invoke();
490

491         oto.waitText("Diffing \"Main.java\" finished");
492         Thread.sleep(1000);
493         cvss.stop();
494         
495         Node nodeClass = new Node(new SourcePackagesNode(projectName), pathToMain);
496         nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
497         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
498         assertEquals("Wrong color for modified file", TestKit.MODIFIED_COLOR, color);
499         
500         //verify next button
501
DiffOperator diffOp = new DiffOperator("Main.java");
502         //
503
try {
504             TimeoutExpiredException afee = null;
505             diffOp.next();
506             diffOp.next();
507             try {
508                 diffOp.next();
509             } catch (TimeoutExpiredException e) {
510                 afee = e;
511             }
512             assertNotNull("TimeoutExpiredException was expected.", afee);
513
514             //verify previous button
515
afee = null;
516             diffOp.previous();
517             diffOp.previous();
518             try {
519                 diffOp.previous();
520             } catch (TimeoutExpiredException e) {
521                 afee = e;
522             }
523             assertNotNull("TimeoutExpiredException was expected.", afee);
524         } catch (Exception JavaDoc e) {
525             System.out.println("Problem with buttons of differences");
526         }
527  
528         //refresh button
529
//oo = OutputOperator.invoke();
530
//oto = oo.getOutputTab(sessionCVSroot);
531
oto = new OutputTabOperator(sessionCVSroot);
532         oto.clear();
533         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "diff/refresh.in");
534         cvss = new PseudoCvsServer(in);
535         new Thread JavaDoc(cvss).start();
536         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
537         diffOp.refresh();
538         oto.waitText("Refreshing CVS Status finished");
539         cvss.stop();
540         Thread.sleep(1000);
541         
542         //update button
543
//oo = OutputOperator.invoke();
544
//oto = oo.getOutputTab(sessionCVSroot);
545
oto = new OutputTabOperator(sessionCVSroot);
546         oto.clear();
547         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "diff/refresh.in");
548         cvss = new PseudoCvsServer(in);
549         new Thread JavaDoc(cvss).start();
550         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
551         diffOp.update();
552         oto.waitText("Updating Sources finished");
553         cvss.stop();
554         Thread.sleep(1000);
555         
556         //commit button
557
CommitOperator co = diffOp.commit();
558         JTableOperator table = co.tabFiles();
559         assertEquals("There should be only one file!", 1, table.getRowCount());
560         assertEquals("There should be Main.java file only!", "Main.java", table.getValueAt(0, 0));
561         co.cancel();
562         
563         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
564         eo.closeAllDocuments();
565         TestKit.deleteRecursively(cacheFolder);
566     }
567     
568     public void testExportDiffPatch() throws Exception JavaDoc {
569         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
570
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 18000);
571
PseudoCvsServer cvss, cvss2, cvss3;
572         InputStream JavaDoc in, in2, in3;
573         //OutputOperator oo;
574
OutputTabOperator oto;
575         org.openide.nodes.Node nodeIDE;
576         String JavaDoc color, CVSroot;
577         
578         oto = new OutputTabOperator(sessionCVSroot);
579         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
580         
581         Node nodeClass = new Node(new SourcePackagesNode(projectName), pathToMain);
582         //nodeClass.select();
583

584         comOperator = new Operator.DefaultStringComparator(true, true);
585         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
586         Operator.setDefaultStringComparator(comOperator);
587         nodeClass.performMenuActionNoBlock("Versioning|CVS|Export");
588         Operator.setDefaultStringComparator(oldOperator);
589         NbDialogOperator dialog = new NbDialogOperator("Export");
590         JTextFieldOperator tf = new JTextFieldOperator(dialog, 0);
591         String JavaDoc patchFile = "/tmp/patch" + System.currentTimeMillis() + ".patch";
592         File JavaDoc file = new File JavaDoc(patchFile);
593         //file.createNewFile();
594
tf.setText(file.getCanonicalFile().toString());
595         JButtonOperator btnExport = new JButtonOperator(dialog, "export");
596         //oo = OutputOperator.invoke();
597

598         oto = new OutputTabOperator(sessionCVSroot);
599         oto.clear();
600         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "diff/export_diff.in");
601         cvss = new PseudoCvsServer(in);
602         new Thread JavaDoc(cvss).start();
603         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
604         btnExport.push();
605         oto.waitText("Diff Patch finished");
606         cvss.stop();
607         Thread.sleep(1000);
608         //test file existence
609
assertTrue("Diff Patch file wasn't created!", file.isFile());
610         BufferedReader JavaDoc br = new BufferedReader JavaDoc(new FileReader JavaDoc(file));
611         String JavaDoc line = br.readLine();
612         boolean generated = false;
613         if (line != null) {
614             generated = line.indexOf("# This patch file was generated by NetBeans IDE") != -1 ? true : false;
615         }
616             
617         br.close();
618         assertTrue("Diff Patch file is empty!", generated);
619         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
620     }
621     
622     public void testResolveConflicts() throws Exception JavaDoc {
623         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
624
PseudoCvsServer cvss, cvss2, cvss3;
625         InputStream JavaDoc in, in2, in3;
626         //OutputOperator oo;
627
OutputTabOperator oto;
628         org.openide.nodes.Node nodeIDE;
629         String JavaDoc color, CVSroot;
630         
631         oto = new OutputTabOperator(sessionCVSroot);
632         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
633         oto.clear();
634         
635         Node nodeClass = new Node(new SourcePackagesNode(projectName), pathToMain);
636         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "diff/create_conflict.in");
637         cvss = new PseudoCvsServer(in);
638         new Thread JavaDoc(cvss).start();
639         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
640         nodeClass.performPopupActionNoBlock("CVS|Update");
641         NbDialogOperator dialog = new NbDialogOperator("Warning");
642         dialog.ok();
643         oto.waitText("cvs server: conflicts found in Main.java");
644         oto.waitText("Updating \"Main.java\" finished");
645         Thread.sleep(1000);
646         cvss.stop();
647         
648         nodeClass = new Node(new SourcePackagesNode(projectName), pathToMain);
649         nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
650         color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
651         assertEquals("Wrong color for file in conflict", TestKit.CONFLICT_COLOR, color);
652         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
653     }
654     
655     public void testCreateBranchForProject() throws Exception JavaDoc {
656         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
657
PseudoCvsServer cvss, cvss2, cvss3;
658         InputStream JavaDoc in, in2, in3;
659         //OutputOperator oo;
660
OutputTabOperator oto;
661         org.openide.nodes.Node nodeIDE;
662         String JavaDoc color, CVSroot;
663         
664         oto = new OutputTabOperator(sessionCVSroot);
665         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
666         
667         Node rootNode = new ProjectsTabOperator().getProjectRootNode(projectName);
668         
669         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "create_new_branch_switch.in");
670         cvss = new PseudoCvsServer(in);
671         new Thread JavaDoc(cvss).start();
672         CVSroot = cvss.getCvsRoot();
673         
674         in2 = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "create_new_branch_switch_1.in");
675         cvss2 = new PseudoCvsServer(in2);
676         new Thread JavaDoc(cvss2).start();
677         //cvsRoot = cvsRoot + cvss2.getCvsRoot();
678
System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
679         
680         BranchOperator bo = BranchOperator.invoke(rootNode);
681         bo.setBranchName("MyNewBranch");
682         bo.checkSwitchToThisBranchAftewards(false);
683         bo.checkTagBeforeBranching(false);
684         oto = new OutputTabOperator(sessionCVSroot);
685         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
686         bo.branch();
687         Thread.sleep(1000);
688         //oo = OutputOperator.invoke();
689
//oto.waitText("Branching \"ForImport [Main]\" finished");
690
oto.waitText("Branch");
691         oto.waitText("ForImport");
692         oto.waitText("finished");
693         cvss.stop();
694         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
695     }
696     
697     public void testSwitchProjectToBranch() throws Exception JavaDoc {
698         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
699
PseudoCvsServer cvss;
700         InputStream JavaDoc in;
701         //OutputOperator oo;
702
OutputTabOperator oto;
703         org.openide.nodes.Node nodeIDE;
704         String JavaDoc color, cvsRoot;
705         
706         oto = new OutputTabOperator(sessionCVSroot);
707         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
708         
709         Node rootNode = new ProjectsTabOperator().getProjectRootNode(projectName);
710         
711         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "create_new_branch_switch_1.in");
712         cvss = new PseudoCvsServer(in);
713         new Thread JavaDoc(cvss).start();
714         cvsRoot = cvss.getCvsRoot();
715         
716         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvsRoot);
717         oto = new OutputTabOperator(sessionCVSroot);
718         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
719         SwitchToBranchOperator sbo = SwitchToBranchOperator.invoke(rootNode);
720         sbo.switchToBranch();
721         sbo.setBranch("MyNewBranch");
722         sbo.pushSwitch();
723         Thread.sleep(1000);
724         //oo = OutputOperator.invoke();
725
oto.waitText(" to Branch finished");
726                
727         cvss.stop();
728         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
729         
730     }
731     
732     public void testRevertModifications() throws Exception JavaDoc {
733         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
734
PseudoCvsServer cvss;
735         InputStream JavaDoc in;
736         //OutputOperator oo;
737
OutputTabOperator oto;
738         org.openide.nodes.Node nodeIDE;
739         String JavaDoc color, cvsRoot;
740         
741         //oo = OutputOperator.invoke();
742
oto = new OutputTabOperator(sessionCVSroot);
743         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
744         oto.clear();
745       
746         //delete RevsionCache folder. It can contain checked out revisions
747
TestKit.deleteRecursively(cacheFolder);
748         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "revert_modifications.in");
749         cvss = new PseudoCvsServer(in);
750         new Thread JavaDoc(cvss).start();
751         Node nodeMain = new Node(new SourcePackagesNode("ForImport"), "forimport|Main.java");
752         nodeMain.performPopupActionNoBlock("CVS|Revert Modifications");
753         NbDialogOperator nbDialog = new NbDialogOperator("Confirm overwrite");
754         JButtonOperator btnYes = new JButtonOperator(nbDialog, "Yes");
755         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
756         btnYes.push();
757         Thread.sleep(1000);
758         oto = new OutputTabOperator(sessionCVSroot);
759         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
760         oto.waitText("Reverting finished");
761         cvss.stop();
762         
763         
764         nodeIDE = (org.openide.nodes.Node) nodeMain.getOpenideNode();
765         assertNull("No color for node expected", nodeIDE.getHtmlDisplayName());
766         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
767     }
768     
769     public void testShowAnnotations() throws Exception JavaDoc {
770         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
771
PseudoCvsServer cvss, cvss2;
772         InputStream JavaDoc in, in2;
773         //OutputOperator oo;
774
OutputTabOperator oto;
775         org.openide.nodes.Node nodeIDE;
776         String JavaDoc color, cvsRoot;
777         
778         TestKit.deleteRecursively(cacheFolder);
779         
780         //oo = OutputOperator.invoke();
781
oto = new OutputTabOperator(sessionCVSroot);
782         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
783         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "show_annotation.in");
784         cvss = new PseudoCvsServer(in);
785         new Thread JavaDoc(cvss).start();
786         
787         in2 = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "show_annotation_1.in");
788         cvss2 = new PseudoCvsServer(in2);
789         new Thread JavaDoc(cvss2).start();
790         
791         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot() + "," + cvss2.getCvsRoot());
792         Node nodeMain = new Node(new SourcePackagesNode("ForImport"), "forimport|Main.java");
793         oto = new OutputTabOperator(sessionCVSroot);
794         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
795         nodeMain.performPopupAction("CVS|Show Annotations");
796         Thread.sleep(1000);
797         oto.waitText("Loading Annotations finished");
798         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
799         cvss.stop();
800         cvss2.stop();
801     }
802     
803     public void testSearchHistory() throws Exception JavaDoc {
804         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
805
PseudoCvsServer cvss, cvss2;
806         InputStream JavaDoc in, in2;
807         //OutputOperator oo;
808
OutputTabOperator oto;
809         org.openide.nodes.Node nodeIDE;
810         String JavaDoc color, cvsRoot;
811         
812         TestKit.deleteRecursively(cacheFolder);
813         
814         //oo = OutputOperator.invoke();
815
oto = new OutputTabOperator(sessionCVSroot);
816         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
817         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "search_history.in");
818         cvss = new PseudoCvsServer(in);
819         new Thread JavaDoc(cvss).start();
820         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
821         Node nodeMain = new Node(new SourcePackagesNode("ForImport"), "forimport|Main.java");
822         //nodeMain.performPopupAction("CVS|Search History...");
823
SearchHistoryOperator sho = SearchHistoryOperator.invoke(nodeMain);
824         oto.waitText("Searching History finished");
825         Thread.sleep(1000);
826         cvss.stop();
827         
828         oto.clear();
829         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "search_history_1.in");
830         cvss = new PseudoCvsServer(in);
831         new Thread JavaDoc(cvss).start();
832         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
833         sho.setUsername("test");
834         sho.setFrom("1.1");
835         sho.setTo("1.1");
836         sho.btSearch().push();
837         oto.waitText("Searching History started");
838         Thread.sleep(1000);
839         cvss.stop();
840         JListOperator list = sho.lstHistory();
841         
842         ListModel JavaDoc model = list.getModel();
843         assertEquals("Wrong result count", 2, model.getSize());
844         assertTrue("Revision \"1.1\" is missing", model.getElementAt(1).toString().indexOf("1.1") > 0);
845         
846         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
847     }
848     
849     public void testVersioningButtons() throws Exception JavaDoc {
850         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 3000);
851
VersioningOperator vo;
852         //OutputOperator oo;
853
OutputTabOperator oto;
854         InputStream JavaDoc in;
855         PseudoCvsServer cvss;
856         String JavaDoc CVSroot;
857         JTableOperator table;
858         org.openide.nodes.Node nodeIDE;
859         String JavaDoc color;
860        
861         oto = new OutputTabOperator(sessionCVSroot);
862         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
863         
864         //perform Show Changes action on Main.java file
865
Node nodeMain = new Node(new SourcePackagesNode(projectName), pathToMain);
866         //oo = OutputOperator.invoke();
867
//System.out.println(sessionCVSroot);
868
in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "versioning/show_changes_main.in");
869         cvss = new PseudoCvsServer(in);
870         new Thread JavaDoc(cvss).start();
871         CVSroot = cvss.getCvsRoot();
872         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
873         nodeMain.performPopupAction("CVS|Show Changes");
874         Thread.sleep(1000);
875         vo = VersioningOperator.invoke();
876         table = vo.tabFiles();
877         //System.out.println(""+table);
878
oto.waitText("Refreshing CVS Status finished");
879         Thread.sleep(1000);
880         assertEquals("Table should be empty", 1, table.getRowCount());
881         assertEquals("File should be [Remotely Modified]", "Remotely Modified", table.getValueAt(0, 1).toString());
882         cvss.stop();
883         //System.out.println("Show Changes is ok");
884

885         //push refresh button
886
//oo = OutputOperator.invoke();
887
//oto = oo.getOutputTab(sessionCVSroot);
888
oto = new OutputTabOperator(sessionCVSroot);
889         oto.clear();
890         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "versioning/refresh_main.in");
891         cvss = new PseudoCvsServer(in);
892         new Thread JavaDoc(cvss).start();
893         CVSroot = cvss.getCvsRoot();
894         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
895         //vo = VersioningOperator.invoke();
896
vo.refresh();
897         oto.waitText("Refreshing CVS Status finished");
898         Thread.sleep(1000);
899         table = vo.tabFiles();
900         assertEquals("Table should be empty", 0, table.getRowCount());
901         cvss.stop();
902         
903         //push Update all
904
//oo = OutputOperator.invoke();
905
oto = new OutputTabOperator(sessionCVSroot);
906         oto.clear();
907         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "versioning/refresh_main.in");
908         cvss = new PseudoCvsServer(in);
909         new Thread JavaDoc(cvss).start();
910         CVSroot = cvss.getCvsRoot();
911         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
912         //vo = VersioningOperator.invoke();
913
vo.update();
914         oto.waitText("Updating Sources finished");
915         Thread.sleep(1000);
916         cvss.stop();
917         
918         //push commit button
919
vo.commit();
920         Thread.sleep(1000);
921         
922         NbDialogOperator dialog = new NbDialogOperator("Comm");
923         JButtonOperator btnOk = new JButtonOperator(dialog, "OK");
924         btnOk.push();
925         
926         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
927     }
928     
929     public void testRemoveFileGetBack() throws Exception JavaDoc {
930         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
931
PseudoCvsServer cvss, cvss2, cvss3;
932         InputStream JavaDoc in, in2, in3;
933         //OutputOperator oo;
934
OutputTabOperator oto;
935         org.openide.nodes.Node nodeIDE;
936         String JavaDoc color, CVSroot;
937         VersioningOperator vo;
938         JTableOperator table;
939         
940         oto = new OutputTabOperator(sessionCVSroot);
941         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
942         
943         TestKit.deleteRecursively(cacheFolder);
944         Node nodeMain = new Node(new SourcePackagesNode(projectName), pathToMain);
945         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "versioning/refresh_main.in");
946         cvss = new PseudoCvsServer(in);
947         new Thread JavaDoc(cvss).start();
948         CVSroot = cvss.getCvsRoot();
949         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
950         nodeMain.performPopupAction("CVS|Show Changes");
951         Thread.sleep(1000);
952         vo = VersioningOperator.invoke();
953         cvss.stop();
954         
955         nodeMain.performPopupActionNoBlock("Delete");
956         NbDialogOperator dialog = new NbDialogOperator("Confirm Object Deletion");
957         dialog.yes();
958         Thread.sleep(1000);
959         table = vo.tabFiles();
960         assertEquals("Files should have been [Locally Deleted]", "Locally Deleted", table.getValueAt(0, 1).toString());
961         //node should disappear
962
TimeoutExpiredException tee = null;
963         try {
964             nodeMain = new Node(new SourcePackagesNode(projectName), pathToMain);
965         } catch (Exception JavaDoc e) {
966             tee = (TimeoutExpiredException) e;
967         }
968         assertNotNull(tee);
969         
970         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "revert_modifications.in");
971         cvss = new PseudoCvsServer(in);
972         new Thread JavaDoc(cvss).start();
973         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
974         
975         //revert delete - get back the file.
976
new Thread JavaDoc(new Runnable JavaDoc() {
977             public void run() {
978                 VersioningOperator vo = VersioningOperator.invoke();
979                 vo.performPopup("Main.java", "Revert Delete");
980             }
981         }).start();
982         dialog = new NbDialogOperator("Confirm overwrite");
983         dialog.yes();
984         oto.waitText("Reverting finished");
985         Thread.sleep(1000);
986         cvss.stop();
987         //node should be back
988
nodeMain = new Node(new SourcePackagesNode(projectName), pathToMain);
989         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
990     }
991     
992     public void testRemoveFileCommit() throws Exception JavaDoc {
993         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);
994
PseudoCvsServer cvss, cvss2, cvss3;
995         InputStream JavaDoc in, in2, in3;
996         //OutputOperator oo;
997
OutputTabOperator oto;
998         org.openide.nodes.Node nodeIDE;
999         String JavaDoc color, CVSroot;
1000        VersioningOperator vo;
1001        JTableOperator table;
1002        
1003        oto = new OutputTabOperator(sessionCVSroot);
1004        oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
1005        
1006        TestKit.deleteRecursively(cacheFolder);
1007        Node nodeMain = new Node(new SourcePackagesNode(projectName), pathToMain);
1008        in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "versioning/refresh_main.in");
1009        cvss = new PseudoCvsServer(in);
1010        new Thread JavaDoc(cvss).start();
1011        CVSroot = cvss.getCvsRoot();
1012        System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
1013        nodeMain.performPopupAction("CVS|Show Changes");
1014        Thread.sleep(1000);
1015        vo = VersioningOperator.invoke();
1016        cvss.stop();
1017        
1018        //delete file again and commit deletion
1019
nodeMain = new Node(new SourcePackagesNode(projectName), pathToMain);
1020        nodeMain.performPopupActionNoBlock("Delete");
1021        NbDialogOperator dialog = new NbDialogOperator("Confirm Object Deletion");
1022        dialog.yes();
1023        Thread.sleep(1000);
1024        table = vo.tabFiles();
1025        assertEquals("Files should have been [Locally Deleted]", "Locally Deleted", table.getValueAt(0, 1).toString());
1026        
1027        TimeoutExpiredException tee = null;
1028        try {
1029            nodeMain = new Node(new SourcePackagesNode(projectName), pathToMain);
1030        } catch (Exception JavaDoc e) {
1031            tee = (TimeoutExpiredException) e;
1032        }
1033        assertNotNull(tee);
1034        
1035        
1036        in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "commit_locally_deleted_main.in");
1037        cvss = new PseudoCvsServer(in);
1038        new Thread JavaDoc(cvss).start();
1039        System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
1040        
1041        //revert delete - get back the file.
1042
CommitOperator co = vo.commit();
1043        table = co.tabFiles();
1044        assertEquals("There should be one file only", 1, table.getRowCount());
1045        assertEquals("There should Main.java file", "Main.java", table.getValueAt(0, 0));
1046        assertEquals("File Main.java should be [Locally Deleted]", "Locally Deleted", table.getValueAt(0, 1));
1047        co.commit();
1048 
1049        Thread.sleep(1000);
1050        cvss.stop();
1051        oto.waitText("Committing finished");
1052        
1053        tee = null;
1054        try {
1055            nodeMain = new Node(new SourcePackagesNode(projectName), pathToMain);
1056        } catch (Exception JavaDoc e) {
1057            tee = (TimeoutExpiredException) e;
1058        }
1059        assertNotNull(tee);
1060        System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
1061    }
1062    
1063    public void removeAllData() {
1064        TestKit.removeAllData(projectName);
1065        System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
1066    }
1067}
1068
Popular Tags