001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package complete;
043:
044: import org.netbeans.jellytools.EditorOperator;
045: import org.netbeans.jellytools.NbDialogOperator;
046: import org.netbeans.jellytools.NewWizardOperator;
047: import org.netbeans.jellytools.TopComponentOperator;
048: import org.netbeans.jellytools.actions.OpenAction;
049: import org.netbeans.jellytools.modules.javacvs.output.AnnotateOutputOperator;
050: import org.netbeans.jellytools.modules.javacvs.output.LogOutputOperator;
051: import org.netbeans.jellytools.modules.javacvs.output.StatusOutputOperator;
052: import org.netbeans.jellytools.modules.vcscore.VCSCommandsOutputOperator;
053: import org.netbeans.jellytools.nodes.FilesystemNode;
054: import org.netbeans.jellytools.nodes.Node;
055: import org.netbeans.jellytools.util.StringFilter;
056: import org.netbeans.jemmy.operators.JTextFieldOperator;
057: import org.netbeans.test.oo.gui.jelly.javacvs.AnnotateDialog;
058: import org.netbeans.test.oo.gui.jelly.javacvs.CommitDialog;
059: import org.netbeans.test.oo.gui.jelly.javacvs.DiffDialog;
060: import org.netbeans.test.oo.gui.jelly.javacvs.LogDialog;
061: import org.netbeans.test.oo.gui.jelly.javacvs.RemoveDialog;
062: import org.netbeans.test.oo.gui.jelly.javacvs.StatusDialog;
063: import org.netbeans.test.oo.gui.jelly.vcscore.OutputOfVCSCommandsFrame;
064:
065: public class AdditionalCommands extends JCVSStub {
066:
067: public AdditionalCommands(String testName) {
068: super (testName);
069: }
070:
071: public static junit.framework.Test suite() {
072: // DEBUG = true;
073: junit.framework.TestSuite suite = new org.netbeans.junit.NbTestSuite();
074: suite.addTest(new AdditionalCommands("configure"));
075: suite.addTest(new AdditionalCommands("testStatusRefresh"));
076: suite.addTest(new AdditionalCommands("testRemove"));
077: // suite.addTest(new AdditionalCommands("testRemoveRecursively")); // !!! do it
078: suite.addTest(new AdditionalCommands("testLogInit"));
079: suite.addTest(new AdditionalCommands("testLogFileFull"));
080: suite.addTest(new AdditionalCommands("testLogFileStrict"));
081: suite.addTest(new AdditionalCommands("testLogDirectory"));
082: suite.addTest(new AdditionalCommands(
083: "testLogDirectoryRecursive"));
084: suite.addTest(new AdditionalCommands("testLogRestrictions"));
085: suite.addTest(new AdditionalCommands("testStatusInit"));
086: suite.addTest(new AdditionalCommands("testStatusFile"));
087: suite.addTest(new AdditionalCommands(
088: "testStatusFileIncludeTags"));
089: suite.addTest(new AdditionalCommands("testStatusDirectory"));
090: suite.addTest(new AdditionalCommands(
091: "testStatusDirectoryRecursive"));
092: suite.addTest(new AdditionalCommands("testAnnotateInit"));
093: suite.addTest(new AdditionalCommands("testAnnotateFileFull"));
094: suite.addTest(new AdditionalCommands("testAnnotateFileStrict"));
095: suite.addTest(new AdditionalCommands("testAnnotateDirectory"));
096: suite.addTest(new AdditionalCommands(
097: "testAnnotateDirectoryRecursive"));
098: suite.addTest(new AdditionalCommands("testAnnotateInvalid"));
099: suite.addTest(new AdditionalCommands("testAnnotateForce"));
100: suite.addTest(new AdditionalCommands("testDiffInit"));
101: suite.addTest(new AdditionalCommands("testDiffFile1Revision"));
102: suite.addTest(new AdditionalCommands("testDiffFile2Revisions"));
103: suite.addTest(new AdditionalCommands("testDiffFileIgnore"));
104: suite.addTest(new AdditionalCommands("testDiffFileFormat"));
105: // suite.addTest(new AdditionalCommands("testDiffDirectory")); // graphical diff not work - used textual diff - but textual is broken too - always fail due to bug #29769
106: suite.addTest(new AdditionalCommands("testUnmount"));
107: return suite;
108: }
109:
110: public static void main(java.lang.String[] args) {
111: junit.textui.TestRunner.run(suite());
112: }
113:
114: GenericNode pac1, subpac1;
115: GenericNode aa1;
116: GenericNode log1, log2;
117:
118: GenericNode pac2, subpac2;
119: GenericNode status1, status2;
120:
121: GenericNode pac3, subpac3;
122: GenericNode anno1, anno2;
123:
124: GenericNode pac4, subpac4;
125: GenericNode diff1, diff2;
126:
127: protected void createStructure() {
128: pac1 = new GenericNode(root, "pac1");
129: subpac1 = new GenericNode(pac1, "subpac1");
130:
131: aa1 = new GenericNode(subpac1, "Aa1", ".java");
132:
133: log1 = new GenericNode(subpac1, "log1", ".java");
134: log2 = new GenericNode(subpac1, "log2", ".java");
135:
136: pac2 = new GenericNode(root, "pac2");
137: subpac2 = new GenericNode(pac2, "subpac2");
138:
139: status1 = new GenericNode(subpac2, "status1", ".java");
140: status2 = new GenericNode(subpac2, "status2", ".java");
141:
142: pac3 = new GenericNode(root, "pac3");
143: subpac3 = new GenericNode(pac3, "subpac3");
144:
145: anno1 = new GenericNode(pac3, "anno1");
146: anno2 = new GenericNode(subpac3, "anno2");
147:
148: pac4 = new GenericNode(root, "pac4");
149: subpac4 = new GenericNode(pac4, "subpac4");
150:
151: diff1 = new GenericNode(subpac4, "diff1");
152: diff2 = new GenericNode(subpac4, "diff2");
153: }
154:
155: public void configure() {
156: super .configure();
157: if (!DEBUG) {
158: createStructure();
159:
160: subpac1.mkdirs();
161: refresh(root);
162: pac1.waitStatus("Local");
163: addDirectory(pac1);
164: refresh(pac1);
165: subpac1.waitStatus("Local");
166: addDirectory(subpac1);
167:
168: subpac2.mkdirs();
169: refresh(root);
170: pac2.waitStatus("Local");
171: addDirectory(pac2);
172: refresh(pac2);
173: subpac2.waitStatus("Local");
174: addDirectory(subpac2);
175:
176: createAddCommitFile(aa1, "Java Classes|Main");
177: }
178: }
179:
180: public void testStatusRefresh() {
181: aa1.waitStatus("Up-to-date; 1.1");
182: String file = loadFile(aa1.file());
183: try {
184: new OpenAction().perform(aa1.jcvsNode());
185: EditorOperator eo = new EditorOperator(aa1.name()
186: + " [Up-to-date; 1.1]");
187:
188: eo.txtEditorPane().typeText("// inserted line\n", 0);
189: eo.waitModified(true);
190: eo.save();
191: eo.waitModified(false);
192: aa1.waitStatus("LMod; 1.1");
193: eo.deleteLine(1);
194: eo.waitModified(true);
195: eo.save();
196: eo.waitModified(false);
197: // eo.close(); // workaround for unreported bug
198:
199: refresh(pac1);
200: aa1.waitStatus("LMod; 1.1");
201: refresh(subpac1);
202: aa1.waitStatus("Up-to-date; 1.1");
203: } finally {
204: saveToFile(getWorkFilePath() + "/modfile1", loadFile(aa1
205: .file()));
206: aa1.save(file);
207: }
208:
209: try {
210: aa1.save("Modify");
211: refresh(aa1);
212: aa1.waitStatus("LMod; 1.1");
213: } finally {
214: saveToFile(getWorkFilePath() + "/modfile2", loadFile(aa1
215: .file()));
216: aa1.save(file);
217: }
218:
219: refresh(pac1);
220: aa1.waitStatus("LMod; 1.1");
221: refresh(subpac1);
222: aa1.waitStatus("Up-to-date; 1.1");
223:
224: try {
225: aa1.save("Modify");
226: refresh(aa1);
227: aa1.waitStatus("LMod; 1.1");
228: } finally {
229: saveToFile(getWorkFilePath() + "/modfile3", loadFile(aa1
230: .file()));
231: aa1.save(file);
232: }
233:
234: refreshRecursively(pac1);
235: aa1.waitStatus("Up-to-date; 1.1");
236: }
237:
238: public void testRemove() {
239: GenericNode remfile = new GenericNode(subpac1, "remfile",
240: ".java");
241: createAddCommitFile(remfile, "Java Classes|Main");
242:
243: closeAllVCSWindows();
244: remfile.jcvsNode().jCVSRemove();
245: RemoveDialog rem = new RemoveDialog();
246: rem.runCommand();
247: rem.waitClosed();
248:
249: OutputOfVCSCommandsFrame output = new OutputOfVCSCommandsFrame();
250: dumpTable(output.tabJTable());
251: remfile.waitStatus("Up-to-date; 1.1");
252:
253: closeAllVCSWindows();
254: remfile.jcvsNode().jCVSRemove();
255: rem = new RemoveDialog();
256: checkCheckBox(rem.cbDeleteBeforeRemove());
257: rem.runCommand();
258: rem.waitClosed();
259:
260: output = new OutputOfVCSCommandsFrame();
261: dumpTable(output.tabJTable());
262: remfile.waitStatus("LRemoved", false);
263:
264: remfile.jcvsNode().jCVSCommit();
265: CommitDialog com = new CommitDialog();
266: com.runCommand();
267: com.waitClosed();
268: remfile.waitHistoryShort("commit -m \"\"");
269: remfile.parent().jcvsNode().waitChildNotPresent(remfile.name());
270: }
271:
272: public void testRemoveRecursively() {
273: // !!! do it
274: }
275:
276: public void testLogInit() {
277: createAddCommitFile(log1, "Java Classes|Empty");
278: log1.waitStatus("Up-to-date; 1.1");
279: createAddCommitFile(log2, "Java Classes|Empty");
280: log2.waitStatus("Up-to-date; 1.1");
281:
282: log1.save("modify - log 1 - 1.2");
283: refresh(log1);
284: log1.waitStatus("LMod; 1.1");
285: commitFile(log1, null, "Desc - log 1 - 1.2");
286: log1.waitStatus("Up-to-date; 1.2");
287:
288: log2.save("modify - log 2 - 1.2");
289: refresh(log2);
290: log2.waitStatus("LMod; 1.1");
291: commitFile(log2, null, "Desc - log 2 - 1.2");
292: log2.waitStatus("Up-to-date; 1.2");
293:
294: addTagFile(log1, "branchtag", true);
295: log1.save("modify - log 1 - branch - 1.2.1.1");
296: refresh(log1);
297: log1.waitStatus("LMod; 1.2");
298: commitFile(log1, "branchtag",
299: "Desc - log 1 - branchtag - 1.2.2.1");
300: log1.waitStatus("Up-to-date; 1.2.2.1");
301: log1.waitVersion("branchtag");
302: }
303:
304: public void testLogFileFull() {
305: closeAllVCSWindows();
306: log1.jcvsNode().jCVSLog();
307: LogDialog dia = new LogDialog();
308: dia.runCommand();
309: dia.waitClosed();
310: log1.waitHistoryShort("log");
311:
312: LogOutputOperator log = new LogOutputOperator(false, false,
313: false);
314: log.dumpFile(out, "/cvsroot/test/jcvs/" + roothis toryshort);
315:
316: compareReferenceFiles();
317: }
318:
319: public void testLogFileStrict() {
320: closeAllVCSWindows();
321: log1.jcvsNode().jCVSLog();
322: LogDialog dia = new LogDialog();
323: checkCheckBox(dia.cbNotRecursively());
324: checkCheckBox(dia.cbDefaultBranchOnly());
325: checkCheckBox(dia.cbNoTags());
326: checkCheckBox(dia.cbHeaderAndDescriptionOnly());
327: checkCheckBox(dia.cbHeaderOnly());
328: dia.runCommand();
329: dia.waitClosed();
330: log1.waitHistoryShort("log -b -t -h -N -l");
331:
332: LogOutputOperator log = new LogOutputOperator(false, true, true);
333: log.dumpFile(out, "/cvsroot/test/jcvs/" + roothis toryshort);
334:
335: compareReferenceFiles();
336: }
337:
338: public void testLogDirectory() {
339: closeAllVCSWindows();
340: pac1.jcvsNode().jCVSLog();
341: LogDialog dia = new LogDialog();
342: checkCheckBox(dia.cbNotRecursively());
343: dia.runCommand();
344: dia.waitClosed();
345: pac1.waitHistoryShort("log -l");
346:
347: LogOutputOperator log = new LogOutputOperator(true, false,
348: false);
349: log.txtContains().clearText();
350: log.txtContains().enterText("Desc - log ");
351: log.dumpAll(out, "/cvsroot/test/jcvs/" + roothis toryshort);
352:
353: compareReferenceFiles();
354: }
355:
356: public void testLogDirectoryRecursive() {
357: closeAllVCSWindows();
358: pac1.jcvsNode().jCVSLog();
359: LogDialog dia = new LogDialog();
360: dia.runCommand();
361: dia.waitClosed();
362: pac1.waitHistoryShort("log");
363:
364: LogOutputOperator log = new LogOutputOperator(true, false,
365: false);
366: log.txtContains().clearText();
367: log.txtContains().enterText("Desc - log ");
368: log.dumpAll(out, "/cvsroot/test/jcvs/" + roothis toryshort);
369:
370: compareReferenceFiles();
371: }
372:
373: public void testLogRestrictions() {
374: pac1.jcvsNode().jCVSLog();
375: LogDialog dia = new LogDialog();
376: checkCheckBox(dia.cbNotRecursively());
377: checkCheckBox(dia.cbDefaultBranchOnly());
378: checkCheckBox(dia.cbNoTags());
379: checkCheckBox(dia.cbHeaderAndDescriptionOnly());
380: checkCheckBox(dia.cbHeaderOnly());
381: checkCheckBox(dia.cbState());
382: dia.txtState().clearText();
383: dia.txtState().typeText("STATE");
384: checkCheckBox(dia.cbRevision());
385: dia.txtRevision().clearText();
386: dia.txtRevision().typeText("REVISION");
387: checkCheckBox(dia.cbDate());
388: dia.txtDate().clearText();
389: dia.txtDate().typeText("DATE");
390: checkCheckBox(dia.cbUser());
391: dia.txtUser().clearText();
392: dia.txtUser().typeText("USER");
393:
394: JTextFieldOperator cvsSwitches = new JTextFieldOperator(dia,
395: "log ");
396: assertEquals("CVS Command String",
397: "log -b -t -h -N -l -wUSER -rREVISION -sSTATE -dDATE ",
398: cvsSwitches.getText());
399: dia.cancel();
400: dia.waitClosed();
401: }
402:
403: public void testStatusInit() {
404: createAddCommitFile(status1, "Java Classes|Empty");
405: status1.waitStatus("Up-to-date; 1.1");
406: createAddCommitFile(status2, "Java Classes|Empty");
407: status2.waitStatus("Up-to-date; 1.1");
408:
409: status1.save("modify - status 1 - 1.2");
410: refresh(status1);
411: status1.waitStatus("LMod; 1.1");
412: commitFile(status1, null, "Desc - status 1 - 1.2");
413: status1.waitStatus("Up-to-date; 1.2");
414:
415: status2.save("modify - status 2 - 1.2");
416: refresh(status2);
417: status2.waitStatus("LMod; 1.1");
418: commitFile(status2, null, "Desc - status 2 - 1.2");
419: status2.waitStatus("Up-to-date; 1.2");
420:
421: addTagFile(status1, "branchtag", true);
422: status1.save("modify - status 1 - branch - 1.2.1.1");
423: refresh(status1);
424: status1.waitStatus("LMod; 1.2");
425: commitFile(status1, "branchtag",
426: "Desc - status 1 - branchtag - 1.2.2.1");
427: status1.waitStatus("Up-to-date; 1.2.2.1");
428: status1.waitVersion("branchtag");
429: }
430:
431: public void testStatusFile() {
432: closeAllVCSWindows();
433: status1.jcvsNode().jCVSStatus();
434: StatusDialog dia = new StatusDialog();
435: dia.runCommand();
436: dia.waitClosed();
437: status1.waitHistoryShort("status");
438:
439: StatusOutputOperator status = new StatusOutputOperator(false);
440: status.dumpFile(out, "/cvsroot/test/jcvs/" + roothis toryshort);
441: status.btGetTags().push();
442: waitNoEmpty(status.tabExistingTags());
443: status.dumpExistingTags(out);
444:
445: compareReferenceFiles();
446: }
447:
448: public void testStatusFileIncludeTags() {
449: closeAllVCSWindows();
450: status1.jcvsNode().jCVSStatus();
451: StatusDialog dia = new StatusDialog();
452: checkCheckBox(dia.cbIncludeTagInfo());
453: dia.runCommand();
454: dia.waitClosed();
455: status1.waitHistoryShort("status -v");
456:
457: StatusOutputOperator status = new StatusOutputOperator(false);
458: status.dumpFile(out, "/cvsroot/test/jcvs/" + roothis toryshort);
459:
460: compareReferenceFiles();
461: }
462:
463: public void testStatusDirectory() {
464: closeAllVCSWindows();
465: pac2.jcvsNode().jCVSStatus();
466: StatusDialog dia = new StatusDialog();
467: checkCheckBox(dia.cbIncludeTagInfo());
468: checkCheckBox(dia.cbNotRecursively());
469: dia.runCommand();
470: dia.waitClosed();
471: pac2.waitHistoryShort("status -v -l");
472:
473: StatusOutputOperator status = new StatusOutputOperator(true);
474: status.dumpAll(out, "/cvsroot/test/jcvs/" + roothis toryshort);
475:
476: compareReferenceFiles();
477: }
478:
479: public void testStatusDirectoryRecursive() {
480: closeAllVCSWindows();
481: pac2.jcvsNode().jCVSStatus();
482: StatusDialog dia = new StatusDialog();
483: checkCheckBox(dia.cbIncludeTagInfo());
484: dia.runCommand();
485: dia.waitClosed();
486: pac2.waitHistoryShort("status -v");
487:
488: StatusOutputOperator status = new StatusOutputOperator(true);
489: status.dumpAll(out, "/cvsroot/test/jcvs/" + roothis toryshort);
490:
491: compareReferenceFiles();
492: }
493:
494: public void testAnnotateInit() {
495: subpac3.mkdirs();
496: refresh(root);
497: pac3.waitStatus("Local");
498: addDirectory(pac3);
499: refresh(pac3);
500: subpac3.waitStatus("Local");
501: addDirectory(subpac3);
502:
503: anno1.save("Commit-1.1");
504: refresh(anno1.parent());
505: anno1.jcvsNode();
506: addFile(anno1, "Add-Desc-1.1");
507: commitFile(anno1, null, "Commit-Desc-1.1");
508: anno1.waitStatus("Up-to-date; 1.1");
509: addTagFile(anno1, "TagName", true);
510: anno1.save("Commit-TagName");
511: refresh(anno1.parent());
512: anno1.waitStatus("LMod; 1.1");
513: commitFile(anno1, "TagName", "Commit-Desc-TagName");
514: anno1.waitStatus("Up-to-date; 1.1.2.1");
515: anno1.waitVersion("TagName");
516:
517: anno2
518: .save("Commit-1.1 - Line1\nCommit-1.1 - Line2\nCommit-1.1 - Line4\nCommit-1.1 - Line5\n");
519: refresh(anno2.parent());
520: anno2.jcvsNode();
521: addFile(anno2, "InitialState");
522: commitFile(anno2, null, "Commit_1.1");
523: anno2.waitStatus("Up-to-date; 1.1");
524: anno2
525: .save("Commit-1.1 - Line1\nCommit-1.1 - Line2 - Modified-1.2\nCommit-1.2 - Line3 - Added-1.2\nCommit-1.1 - Line4\nCommit-1.1 - Line5 - Modified-1.2\n");
526: commitFile(anno2, null, "Commit_1.2");
527: anno2.waitStatus("Up-to-date; 1.2");
528: anno2
529: .save("Commit-1.3 - Line0 - Added-1.3\nCommit-1.1 - Line1\nCommit-1.1 - Line2 - Modified-1.2 - Modified-1.3\nCommit-1.2 - Line3 - Added-1.2\nCommit-1.1 - Line4\nCommit-1.1 - Line5 - Modified-1.2\n");
530: commitFile(anno2, null, "Commit_1.3");
531: anno2.waitStatus("Up-to-date; 1.3");
532: }
533:
534: public void testAnnotateFileFull() {
535: closeAllVCSWindows();
536: anno2.jcvsNode().jCVSAnnotate();
537: AnnotateDialog dia = new AnnotateDialog();
538: dia.runCommand();
539: dia.waitClosed();
540: anno2.waitHistoryShort("annotate");
541:
542: AnnotateOutputOperator aoo = new AnnotateOutputOperator(false);
543: aoo.dumpFile(out, roothis toryshort);
544:
545: compareReferenceFiles();
546: }
547:
548: public void testAnnotateFileStrict() {
549: AnnotateDialog dia;
550: AnnotateOutputOperator aoo;
551:
552: closeAllVCSWindows();
553: anno1.jcvsNode().jCVSAnnotate();
554: dia = new AnnotateDialog();
555: checkCheckBox(dia.cbDate());
556: checkCheckBox(dia.cbRevisionTag());
557: dia.txtRevisionTag().typeText("TagName");
558: checkCheckBox(dia.cbForceHead());
559: dia.runCommand();
560: dia.waitClosed();
561: dia = null;
562: anno1.waitHistoryShort("annotate -r TagName -D -f");
563:
564: aoo = new AnnotateOutputOperator(false);
565: aoo.dumpFile(out, roothis toryshort);
566: aoo = null;
567:
568: compareReferenceFiles();
569: }
570:
571: public void testAnnotateDirectory() {
572: closeAllVCSWindows();
573: pac3.jcvsNode().jCVSAnnotate();
574: AnnotateDialog dia = new AnnotateDialog();
575: checkCheckBox(dia.cbNotRecursively());
576: dia.runCommand();
577: dia.waitClosed();
578: pac3.waitHistoryShort("annotate -l");
579:
580: AnnotateOutputOperator aoo = new AnnotateOutputOperator(true);
581: aoo.dumpAll(out, roothis toryshort);
582:
583: compareReferenceFiles();
584: }
585:
586: public void testAnnotateDirectoryRecursive() {
587: closeAllVCSWindows();
588: pac3.jcvsNode().jCVSAnnotate();
589: AnnotateDialog dia = new AnnotateDialog();
590: dia.runCommand();
591: dia.waitClosed();
592: pac3.waitHistoryShort("annotate");
593:
594: AnnotateOutputOperator aoo = new AnnotateOutputOperator(true);
595: aoo.dumpAll(out, roothis toryshort);
596:
597: compareReferenceFiles();
598: }
599:
600: public void testAnnotateInvalid() {
601: closeAllVCSWindows();
602: anno1.jcvsNode().jCVSAnnotate();
603: AnnotateDialog dia = new AnnotateDialog();
604: checkCheckBox(dia.cbDate());
605: checkCheckBox(dia.cbRevisionTag());
606: dia.txtRevisionTag().typeText("InvalidTagName");
607: checkCheckBox(dia.cbForceHead());
608: dia.runCommand();
609: dia.waitClosed();
610:
611: NbDialogOperator d = new NbDialogOperator("CVS Error");
612: d.close();
613: d.waitClosed();
614: }
615:
616: public void testAnnotateForce() {
617: AnnotateDialog dia;
618: AnnotateOutputOperator aoo;
619:
620: addTagFile(pac3, "NewTag", true);
621: GenericNode anno3 = new GenericNode(pac3, "anno3", ".java");
622: createAddCommitFile(anno3, "Java Classes|Empty");
623:
624: out.println("+=== No Force ===+");
625: closeAllVCSWindows();
626: pac3.jcvsNode().jCVSAnnotate();
627: dia = new AnnotateDialog();
628: checkCheckBox(dia.cbRevisionTag());
629: dia.txtRevisionTag().typeText("NewTag");
630: checkCheckBox(dia.cbForceHead());
631: dia.runCommand();
632: dia.waitClosed();
633: pac3.waitHistoryShort("annotate -r NewTag -f");
634:
635: aoo = new AnnotateOutputOperator(true);
636: aoo.dumpAll(out, roothis toryshort);
637:
638: out.println("+=== Force HEAD ===+");
639: closeAllVCSWindows();
640: pac3.jcvsNode().jCVSAnnotate();
641: dia = new AnnotateDialog();
642: checkCheckBox(dia.cbRevisionTag());
643: dia.txtRevisionTag().typeText("NewTag");
644: dia.runCommand();
645: dia.waitClosed();
646: pac3.waitHistoryShort("annotate -r NewTag");
647:
648: aoo = new AnnotateOutputOperator(true);
649: aoo.dumpAll(out, roothis toryshort);
650:
651: compareReferenceFiles();
652: }
653:
654: public void testDiffInit() {
655: subpac4.mkdirs();
656: refresh(root);
657: pac4.waitStatus("Local");
658: addDirectory(pac4);
659: refresh(pac4);
660: subpac4.waitStatus("Local");
661: addDirectory(subpac4);
662:
663: diff1
664: .save("Commit-1.1\nWhitespace Check\nSpace Changes Check\nCase-sensitive Check\nNewLines Check\nEnd of NewLines Check\n");
665: refresh(diff1.parent());
666: diff1.jcvsNode();
667: addFile(diff1, "Add-Desc-1.1");
668: commitFile(diff1, null, "Commit-Desc-1.1");
669: diff1.waitStatus("Up-to-date; 1.1");
670: diff1
671: .save("Commit-1.1\n Whitespace Check \nSpace Changes Check\ncASE-SENsitive Check\nNewLines Check\n\n\n\nEnd of NewLines Check\n");
672: refresh(diff1.parent());
673: diff1.waitStatus("LMod; 1.1");
674:
675: diff2
676: .save("Commit-1.1 - Line1\nCommit-1.1 - Line2\nCommit-1.1 - Line4\nCommit-1.1 - Line5\n");
677: refresh(diff2.parent());
678: diff2.jcvsNode();
679: addFile(diff2, "InitialState");
680: commitFile(diff2, null, "Commit_1.1");
681: diff2.waitStatus("Up-to-date; 1.1");
682: diff2
683: .save("Commit-1.1 - Line1\nCommit-1.1 - Line2 - Modified-1.2\nCommit-1.2 - Line3 - Added-1.2\nCommit-1.1 - Line4\nCommit-1.1 - Line5 - Modified-1.2\n");
684: commitFile(diff2, null, "Commit_1.2");
685: diff2.waitStatus("Up-to-date; 1.2");
686: diff2
687: .save("Commit-1.3 - Line0 - Added-1.3\nCommit-1.1 - Line1\nCommit-1.1 - Line2 - Modified-1.2 - Modified-1.3\nCommit-1.2 - Line3 - Added-1.2\nCommit-1.1 - Line4\nCommit-1.1 - Line5 - Modified-1.2\n");
688: commitFile(diff2, null, "Commit_1.3");
689: diff2.waitStatus("Up-to-date; 1.3");
690: }
691:
692: public void dumpDiffGraphical(GenericNode node) {
693: TopComponentOperator tco = new TopComponentOperator("Diff "
694: + node.filename(0));
695: out.println("==== Diff: " + node.filename(0));
696: try {
697: dumpDiffGraphical(tco);
698: } finally {
699: tco.close();
700: waitIsShowing(tco.getSource());
701: }
702: }
703:
704: public void dumpDiffTextual(GenericNode node, String command) {
705: VCSCommandsOutputOperator coo = new VCSCommandsOutputOperator(
706: "Diff");
707: out.println("==== Diff: " + node.filename(0));
708: waitNoEmpty(coo.txtStandardOutput());
709: String txt = coo.txtStandardOutput().getText();
710: info.println("==== Diff: " + node.filename(0));
711: info.println(txt);
712: StringFilter sf = new StringFilter();
713: sf.addReplaceAllFilter(
714: "/cvsroot/test/jcvs/" + roothis toryshort,
715: "<REPOSITORY_PREFIX>");
716: sf.addReplaceFilter("*** " + node.history(), "", "*** "
717: + node.history() + "<FILTERED>");
718: sf.addReplaceFilter("--- " + node.history(), "", "--- "
719: + node.history() + "<FILTERED>");
720: sf.addReplaceFilter("+++ " + node.history(), "", "+++ "
721: + node.history() + "<FILTERED>");
722: printFiltered(txt, sf);
723: }
724:
725: public void testDiffFile1Revision() {
726: DiffDialog dia;
727:
728: diff2.jcvsNode().jCVSDiff();
729: dia = new DiffDialog();
730: dia.txtRevision1().typeText("1.1");
731: dia.runCommand();
732: dia.waitClosed();
733: dia = null;
734: diff2.waitHistoryShort("diff -r 1.1");
735: out.println("==== 1 revision ====");
736: dumpDiffGraphical(diff2);
737:
738: compareReferenceFiles();
739: }
740:
741: public void testDiffFile2Revisions() {
742: DiffDialog dia;
743:
744: diff2.jcvsNode().jCVSDiff();
745: dia = new DiffDialog();
746: dia.txtRevision1().typeText("1.1");
747: dia.txtRevision2().typeText("1.2");
748: dia.runCommand();
749: dia.waitClosed();
750: dia = null;
751: diff2.waitHistoryShort("diff -r 1.1 -r 1.2");
752: out.println("==== 2 revisions ====");
753: dumpDiffGraphical(diff2);
754:
755: compareReferenceFiles();
756: }
757:
758: public void testDiffFileIgnore() {
759: DiffDialog dia;
760:
761: diff1.jcvsNode().jCVSDiff();
762: dia = new DiffDialog();
763: checkCheckBox(dia.cbIgnoreAllWhitespace());
764: dia.runCommand();
765: dia.waitClosed();
766: dia = null;
767: diff1.waitHistoryShort("diff -w");
768: out.println("==== cbIgnoneAllWhitespace ====");
769: dumpDiffGraphical(diff1);
770:
771: diff1.jcvsNode().jCVSDiff();
772: dia = new DiffDialog();
773: checkCheckBox(dia.cbIgnoreBlankLines());
774: dia.runCommand();
775: dia.waitClosed();
776: dia = null;
777: diff1.waitHistoryShort("diff -B");
778: out.println("==== cbIgnoreBlankLines ====");
779: dumpDiffGraphical(diff1);
780:
781: diff1.jcvsNode().jCVSDiff();
782: dia = new DiffDialog();
783: checkCheckBox(dia.cbIgnoreCase());
784: dia.runCommand();
785: dia.waitClosed();
786: dia = null;
787: diff1.waitHistoryShort("diff -i");
788: out.println("==== cbIgnoreCase ====");
789: dumpDiffGraphical(diff1);
790:
791: diff1.jcvsNode().jCVSDiff();
792: dia = new DiffDialog();
793: checkCheckBox(dia.cbIgnoreSpaceChanges());
794: dia.runCommand();
795: dia.waitClosed();
796: dia = null;
797: diff1.waitHistoryShort("diff -b");
798: out.println("==== cbIgnoreSpaceChanges ====");
799: dumpDiffGraphical(diff1);
800:
801: diff1.jcvsNode().jCVSDiff();
802: dia = new DiffDialog();
803: checkCheckBox(dia.cbIgnoreAllWhitespace());
804: checkCheckBox(dia.cbIgnoreBlankLines());
805: checkCheckBox(dia.cbIgnoreCase());
806: checkCheckBox(dia.cbIgnoreSpaceChanges());
807: dia.runCommand();
808: dia.waitClosed();
809: dia = null;
810: out.println("==== Ignore All ====");
811: assertInformationDialog("Diff showed no difference on the following file:");
812: diff1.waitHistoryShort("diff -w -B -i -b");
813:
814: compareReferenceFiles();
815: }
816:
817: public void testDiffFileFormat() {
818: DiffDialog dia;
819:
820: closeAllVCSWindows();
821: diff1.jcvsNode().jCVSDiff();
822: dia = new DiffDialog();
823: checkCheckBox(dia.cbContextOutput());
824: dia.runCommand();
825: dia.waitClosed();
826: dia = null;
827: out.println("==== cbContextOutput ====");
828: dumpDiffTextual(diff1, "diff -c");
829:
830: closeAllVCSWindows();
831: diff1.jcvsNode().jCVSDiff();
832: dia = new DiffDialog();
833: checkCheckBox(dia.cbUnifiedOutput());
834: dia.runCommand();
835: dia.waitClosed();
836: dia = null;
837: out.println("==== cbUnifiedOutput ====");
838: dumpDiffTextual(diff1, "diff -u");
839:
840: compareReferenceFiles();
841: }
842:
843: public void testDiffDirectory() {
844: DiffDialog dia;
845:
846: closeAllVCSWindows();
847: pac4.jcvsNode().jCVSDiff();
848: dia = new DiffDialog();
849: dia.runCommand();
850: dia.waitClosed();
851: dia = null;
852: out.println("==== Recursively ====");
853: dumpDiffTextual(pac4, "diff");
854:
855: closeAllVCSWindows();
856: pac4.jcvsNode().jCVSDiff();
857: dia = new DiffDialog();
858: checkCheckBox(dia.cbNotRecursively());
859: dia.runCommand();
860: dia.waitClosed();
861: dia = null;
862: out.println("==== NOT Recursively ====");
863: dumpDiffTextual(pac4, "diff -l");
864:
865: compareReferenceFiles();
866: }
867:
868: public void testUnmount() {
869: new FilesystemNode(exp.repositoryTab().tree(), root.node())
870: .unmount();
871: new Node(exp.repositoryTab().tree(), "")
872: .waitChildNotPresent(root.node());
873: }
874:
875: }
|