KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > validation > JavaCVSValidationTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * JavaCVSValidationTest.java
22  *
23  * Created on December 12, 2001, 11:09 AM
24  * Last Update: $Date: 2006/06/30 20:17:47 $
25  */

26
27 package validation;
28
29 import java.awt.Color JavaDoc;
30 import java.awt.Container JavaDoc;
31 import java.lang.reflect.Method JavaDoc;
32 import java.io.*;
33 import java.util.Enumeration JavaDoc;
34 import java.util.Properties JavaDoc;
35 import java.util.Set JavaDoc;
36 import javax.swing.text.Style JavaDoc;
37 import javax.swing.text.StyledDocument JavaDoc;
38 import javax.swing.text.StyleConstants.ColorConstants;
39 import javax.swing.tree.TreePath JavaDoc;
40 import junit.framework.*;
41
42 //import org.netbeans.jemmy.*;
43
import org.netbeans.jemmy.EventTool;
44 import org.netbeans.jemmy.JemmyProperties;
45 import org.netbeans.jemmy.TestOut;
46 import org.netbeans.jemmy.JemmyException;
47 import org.netbeans.jemmy.operators.*;
48 import org.netbeans.jemmy.util.PNGEncoder;
49 import org.netbeans.junit.*;
50
51 // New Jelly2 lib
52
import org.netbeans.jellytools.*;
53 import org.netbeans.jellytools.actions.*;
54 import org.netbeans.jellytools.nodes.*;
55 import org.netbeans.jellytools.properties.*;
56 import org.netbeans.jellytools.modules.javacvs.actions.*;
57 import org.netbeans.jellytools.modules.javacvs.output.JCVSDiffOutputOperator;
58 import org.netbeans.jellytools.modules.javacvs.output.LogOutputOperator;
59 import org.netbeans.jellytools.modules.javacvs.output.StatusOutputOperator;
60 import org.netbeans.jellytools.modules.vcscore.actions.*;
61 import org.netbeans.jellytools.modules.vcscore.VCSGroupsFrameOperator;
62 import org.netbeans.jellytools.modules.vcscore.VersioningFrameOperator;
63 import org.netbeans.jellytools.modules.vcscore.GroupVerificationOperator;
64 import org.netbeans.jemmy.Waitable;
65 import org.netbeans.jemmy.Waiter;
66
67 //import org.netbeans.jellytools.properties.editors.*;
68
//import org.netbeans.jellytools.modules.javacvs.*;
69

70 // Old Jelly lib
71
//import org.netbeans.test.oo.gui.jam.*;
72
//import org.netbeans.test.oo.gui.jello.*;
73
//import org.netbeans.test.oo.gui.jelly.*;
74
import org.netbeans.test.oo.gui.jelly.vcscore.*;
75 //import org.netbeans.test.oo.gui.jelly.vcscore.wizard.*;
76
import org.netbeans.test.oo.gui.jelly.javacvs.*;
77
78 import org.openide.options.SystemOption;
79 import org.netbeans.modules.cvsclient.JavaCvsSettings;
80 import org.openide.filesystems.FileSystem;
81 import org.openide.filesystems.Repository;
82
83 /** XTest / JUnit test class performing validation of JavaCVS module
84  *
85  * @author <a HREF="mailto:adam.sotona@sun.com">Adam Sotona</a>
86  * @see #suite JavaCVS validation testsuite definition
87  * @version 1.0
88  */

89 public class JavaCVSValidationTest extends JellyTestCase {
90     
91     static util.History his;
92     static String JavaDoc path;
93     static String JavaDoc repositoryprefix;
94     static String JavaDoc CVSlbl = Bundle.getStringTrimmed("org.netbeans.modules.javacvs.Bundle", "JavaCvsFileSystem.validFilesystemLabel");
95     static String JavaDoc filesystem;
96     static FileSystem testedJavaCVSFS;
97
98     /* Site specific properties */
99     final String JavaDoc SERVER = System.getProperty("SERVER");
100     final String JavaDoc REPOSITORY = System.getProperty("REPOSITORY");
101     final String JavaDoc SERVERTYPE = System.getProperty("SERVERTYPE");
102     final String JavaDoc USER = System.getProperty("USER");
103     final String JavaDoc PASSWORD = System.getProperty("PASSWORD");
104     final String JavaDoc PORT = System.getProperty("PORT");
105     final String JavaDoc MODULE = System.getProperty("MODULE");
106     
107     static final String JavaDoc WORKDIR = "JavaCVSwork";
108     static final String JavaDoc TESTDIR = "testdir";
109     static final String JavaDoc TESTFILE = "testfile";
110     static final String JavaDoc TESTFILEPROPERTY = "javacvs.validation.test.file";
111
112     static final String JavaDoc VERSIONINGMENU = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "Menu/Versioning");
113     static final String JavaDoc MOUNTVCS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "CTL_MountActionName");
114     static String JavaDoc CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
115     static String JavaDoc strCmdAction;
116     static File testFile = null;
117     static MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
118
119     static final boolean capture = true;
120     PrintStream psRef;
121     PrintStream ps;
122 // PrintStream pstreams [] = {ps , psRef}; it's not neccessary anymore. See tearDown()
123

124     APIController api;
125     
126     /** store previously used comparator
127      */

128     Operator.StringComparator oldComparator = Operator.getDefaultStringComparator();
129     
130     /** constructor required by JUnit
131      * @param testName method name to be used as testcase
132      */

133     public JavaCVSValidationTest(String JavaDoc testName) {
134         super(testName);
135     }
136     
137     /** method used for explicit testsuite definition<br>
138      * JavaCVS validation suite is order-sensitive <br>
139      * Contains also <i>commented</i> TRY-CATCH BLOCK
140      * with set longer timeouts. This should be uncommented
141      * on slower machines.
142      *
143      *
144      * @return JavaCVS validation testsuite
145      * @see #testConnectionManager 1.testConnectionManager
146      * @see #testMount <br>2.testMount
147      * @see #testHistory <br>3.testHistory
148      * @see #testCreateFile <br>4.testCreateFile
149      * @see #testAdd <br>5.testAdd
150      * @see #testCommit <br>6.testCommit
151      * @see #testDiff <br>7.testDiff
152      * @see #testVCSGroups <br>8.testVCSGroups
153      * @see #testVersioningExplorer <br>9.testVersioningExplorer
154      * @see #testBranch <br>10.testBranch
155      * @see #testUpdateBranch <br>11.testUpdateBranch
156      * @see #testCommitToBranch <br>12.testCommitToBranch
157      * @see #testMerge <br>13.testMerge
158      * @see #testStatus <br>14.testStatus
159      * @see #testLog <br>15.testLog
160      * @see #testAnnotate <br>16.testAnnotate
161      * @see #testUnmount <br>17.testUnmount
162      * @see #testUndock <br>18.testUndock
163      */

164     public static junit.framework.Test suite() {
165         TestSuite suite = new NbTestSuite();
166         suite.addTest(new JavaCVSValidationTest("testConnectionManager"));
167         suite.addTest(new JavaCVSValidationTest("testMount"));
168         suite.addTest(new JavaCVSValidationTest("testHistory"));
169         suite.addTest(new JavaCVSValidationTest("testCreateFile"));
170         suite.addTest(new JavaCVSValidationTest("testAdd"));
171         suite.addTest(new JavaCVSValidationTest("testCommit"));
172         suite.addTest(new JavaCVSValidationTest("testDiff"));
173         suite.addTest(new JavaCVSValidationTest("testVCSGroups"));
174         suite.addTest(new JavaCVSValidationTest("testVersioningExplorer"));
175         suite.addTest(new JavaCVSValidationTest("testBranch"));
176         suite.addTest(new JavaCVSValidationTest("testUpdateBranch"));
177         suite.addTest(new JavaCVSValidationTest("testCommitToBranch"));
178         suite.addTest(new JavaCVSValidationTest("testMerge"));
179         suite.addTest(new JavaCVSValidationTest("testStatus"));
180         suite.addTest(new JavaCVSValidationTest("testLog"));
181         suite.addTest(new JavaCVSValidationTest("testAnnotate"));
182         suite.addTest(new JavaCVSValidationTest("testUnmount"));
183         suite.addTest(new JavaCVSValidationTest("testUndock"));
184         return suite;
185     }
186     
187     /** Use for internal test execution inside IDE
188      * @param args command line arguments
189      */

190     public static void main(java.lang.String JavaDoc[] args) throws IOException {
191         /* Execution Xtestu using ANT
192         ant -Dxtest.userdata.propertyfile=/home.local/danielm/cvs/ide/javacvs/test/qa-functional/src/site-specific/JavaCVSValidationTest_home.properties
193          */

194
195         /* Preparing xtest.userdate properties for internal usage
196          */

197         InputStream inStream = JavaCVSValidationTest.class.getResourceAsStream("/site-specific/JavaCVSValidationTest_home.properties");
198         Properties JavaDoc pro = System.getProperties();
199         pro.load(inStream);
200         Set JavaDoc set = pro.keySet();
201         String JavaDoc[] str = (String JavaDoc[]) set.toArray(new String JavaDoc[set.size ()]);
202
203         if (str != null)
204             for (int i = 0; i < str.length; i ++)
205                 if (str[i].startsWith ("xtest.userdata"))
206                     System.setProperty(str[i].substring (str[i].indexOf ('|') + 1), System.getProperty (str[i]));
207         pro.list(System.out);
208         
209         junit.textui.TestRunner.run(suite());
210     }
211
212     /** method called before each testcase<br>
213      * sets long Jemmy WaitComponentTimeout and switches JavaCVS UI mode
214      */

215     protected void setUp() {
216         new EventTool().waitNoEvent(2000);
217         System.out.println(getName());
218         ((JavaCvsSettings)SystemOption.findObject(JavaCvsSettings.class, true)).setUiMode(1);
219 // JellyProperties.setJemmyDebugTimeouts();
220
JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout",20000);
221     api = new APIController();
222         api.setOut (new PrintWriter (System.out, true));
223         //api.setOut (new PrintWriter (getLog(), true));
224
ps = getLog ("jemmy.log");
225         psRef = getRef();
226         
227 // JellyProperties.setJemmyOutput(new PrintWriter(ps, true), new PrintWriter(ps, true));
228
JemmyProperties.getCurrentOutput().setAutoFlushMode(true);
229         
230         /* Seems that Robot dispatching is not safe on my linux (RedHat7.1, KDE2.1.1)
231          * Test usualy fails at testMount() method when pushMenuNoBlock on Verisoning menu
232          * and if it goes through the all test. My WindowMAnager is confused. I have to restart X-server :-(
233          */

234         //JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
235
// JemmyProperties.setCurrentDispatchingModel(JemmyProperties.QUEUE_MODEL_MASK);
236
log("setUp(DispatchModel)="+JemmyProperties.getCurrentDispatchingModel());
237         
238         /* Jemmy & Gnome workarround:
239          * Usually happens on Linux and Gnome that just activated window doesn't have focus.
240          * Calling this method :
241          * ComponentOperator.setDefaultComponentVisualizer(new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false);
242          * or setting the following JellyProperty should help it:
243          */

244         //JellyProperties.setLinuxWindowActivation(true);
245
if (testedJavaCVSFS != null )
246             initHistory(testedJavaCVSFS);
247
248     }
249     
250     /** method called after each testcase<br>
251      * resets Jemmy WaitComponentTimeout
252      */

253     protected void tearDown() {
254         JemmyProperties.setCurrentOutput(TestOut.getNullOutput());
255 /* it is automaticaly flushed after returning into NbTestCase
256         pstreams[0] = ps;
257         pstreams[1] = psRef;
258
259         for (int i=0 ; i < pstreams.length; i++) {
260             pstreams[i].flush();
261             pstreams[i].close ();
262         }
263 */

264 // if ( ps != null ) ps.close();
265
// if ( psRef != null) ps.close();
266
}
267     
268     void fail(Exception JavaDoc e) {
269         e.printStackTrace(getLog());
270         if (capture) {
271             try {
272                 PNGEncoder.captureScreen(getWorkDirPath()+"/screen.png");
273             } catch (IOException ioe) {}
274         }
275         throw new AssertionFailedErrorException(e);
276     }
277
278     /** Method called in case of fail or error just after screen shot and XML dumps. <br>
279      * Override this method when you need to be notified about test failures or errors
280      * but avoid any exception to be throwed from this method.<br>
281      * super.failNotify() does not need to be called because it is empty.
282      * @param reason Throwable reason of current fail */

283     protected void failNotify(Throwable JavaDoc reason) {
284         System.out.println("jsi v failNotify()");
285         sbt.printStatusTextHistory(ps);
286         System.out.println(sbt.getStatusTextHistory().toString());
287         if (his != null)
288             his.print ();
289     }
290     
291     protected void dumpDiffGraphical (TopComponentOperator tco) {
292         JEditorPaneOperator p1 = new JEditorPaneOperator (tco, 0);
293         JEditorPaneOperator p2 = new JEditorPaneOperator (tco, 1);
294         psRef.println ("==== Text - Panel 1 ====");
295         psRef.println (p1.getText ());
296         psRef.println ("==== Text - Panel 2 ====");
297         psRef.println (p2.getText ());
298         StyledDocument JavaDoc sd1 = (StyledDocument JavaDoc) p1.getDocument();
299         StyledDocument JavaDoc sd2 = (StyledDocument JavaDoc) p2.getDocument();
300         psRef.println ("==== Colors - Panel 1 ====");
301         dumpColors(sd1);
302         psRef.println ("==== Colors - Panel 2 ====");
303         dumpColors(sd2);
304     }
305
306     protected static final Color JavaDoc annoWhite = new Color JavaDoc (254, 254, 254);
307     protected static final Color JavaDoc annoGreen = new Color JavaDoc (180, 255, 180);
308     protected static final Color JavaDoc annoBlue = new Color JavaDoc (160, 200, 255);
309     protected static final Color JavaDoc annoRed = new Color JavaDoc (255, 160, 180);
310     
311     protected void dumpColors (StyledDocument JavaDoc sd) {
312         int b = sd.getLength();// * 2;
313
// psRef.println ("Len: " + b);
314
for (int a = 0; a < b; a ++) {
315             Style JavaDoc st = sd.getLogicalStyle(a);
316             if (st == null)
317                 continue;
318             Color JavaDoc col = (Color JavaDoc) st.getAttribute(ColorConstants.Background);
319             String JavaDoc str;
320             if (annoWhite.equals (col))
321                 str = "White";
322             else if (annoGreen.equals (col))
323                 str = "Green";
324             else if (annoBlue.equals (col))
325                 str = "Blue";
326             else if (annoRed.equals (col))
327                 str = "Red";
328             else
329                 str = col.toString ();
330             psRef.println ("Pos: " + a + " ---- " + str);
331             a ++;
332         }
333     }
334
335     File getJavaCVSWork() throws IOException {
336         return new File(getWorkDir().getParentFile(), WORKDIR);
337     }
338     
339     File getTestFile() throws IOException {
340         return (testFile==null)?new File(System.getProperty(TESTFILEPROPERTY)):testFile;
341     }
342     
343     void setTestFile(File f) {
344         testFile=f;
345         System.setProperty(TESTFILEPROPERTY, f.getAbsolutePath());
346     }
347     
348     void setClassVariable() {
349         try {
350             path = getJavaCVSWork().getAbsolutePath();
351         } catch (IOException e) {
352             e.printStackTrace();
353         }
354         filesystem = CVSlbl + path;
355     }
356     
357     FileSystem getTestedJavaCVSFS(String JavaDoc filesystem) {
358 // setClassVariable();
359
Enumeration JavaDoc enFS = Repository.getDefault().getFileSystems();
360         FileSystem tmpFS;
361         while(enFS.hasMoreElements()) {
362             tmpFS = (FileSystem) enFS.nextElement();
363             if (tmpFS.getDisplayName().equals(filesystem)) {
364                 testedJavaCVSFS = tmpFS;
365                 return tmpFS;
366             }
367         }
368         return null;
369     }
370     
371     /** Inicializing of History object
372      */

373     void initHistory(FileSystem testedJavaCVSFS) {
374         his = new util.History(testedJavaCVSFS, getLog ());
375         his.setBreakpoint (null);
376         his.switchToJCVS();
377     }
378     
379     /** invokes Connection Manager window from Versioning menu, adds new record and performs login
380      * @throws Exception any unexpected exception thrown during test
381      * @see #testMount next: testMount
382      */

383     public void testConnectionManager() {
384         this.clearTestStatus();
385         this.startTest();
386         /* Please, don't change the following line !!!
387          * necessary for treating result of the test
388          */

389         log("witchBRANCH", "This test suit was checkouted as the *release34*");
390         try {
391             log("Trying to push Main Menu:\n"+VERSIONINGMENU+"|"+Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.login.Bundle", "LoginManagerAction.dialogTitle")+"\n");
392             new JCVSConnectionManagerAction().perform();
393             log("Trying to invoke CVS Connection Manager dialog\n");
394             CVSConnectionDialog conn = new CVSConnectionDialog();
395             
396             conn.activate();
397             log("Trying to find and click 'Add' button to open Login Manager Dialog\n");
398             CVSConnectionDialog.AddNewRootDialog add = conn.add();
399             log("Trying to fill-in the dialog:\n"+SERVERTYPE+","+ SERVER+","+ USER+","+ PORT+","+ REPOSITORY+"\n");
400             add.setAddNewRootOptions(SERVERTYPE, SERVER, USER, PORT, REPOSITORY);
401             add.compareAddNewRootOptions(SERVERTYPE, SERVER, USER, PORT, REPOSITORY);
402             add.verify();
403             log("Trying to find and click 'OK' button\n");
404             add.ok();
405             CVSConnectionDialog.LoginToPserverDialog login = new CVSConnectionDialog.LoginToPserverDialog();
406             log("Trying to write PASSWD in to the textfield: "+PASSWORD+"\n");
407             login.setJPasswordField(PASSWORD);
408             login.verify();
409             log("Trying to find and click 'Login' button\n");
410             login.login();
411             int i=0;
412             while ((i++<30)&&(login.isVisible())) {
413                 Thread.sleep(1000);
414             }
415             log("Trying to verify the login dialog\n");
416             conn.verify();
417             endTest();
418             log("Trying to find 'Close' button\n");
419             conn.close();
420         } catch (Exception JavaDoc e) {
421             fail(e);
422         }
423     }
424     
425     /** invokes CVS Wizard from Versioning menu, sets workdir, connection settings and performs initial checkout of module
426      * @throws Exception any unexpected exception thrown during test
427      * @see #testConnectionManager depends on: testConnectionManager
428      * @see #testHistory <br>next: testHistory
429      */

430     public void testMount() {
431         startTest();
432         try {
433             log("JavaCVSWork dir is:\n"+getJavaCVSWork()+"\n");
434             File f = getJavaCVSWork();
435             assertTrue(f.mkdirs());
436
437 // log("Nasty workaround for bug #31026");
438
log("Trying to push MainMenu:\n"+VERSIONINGMENU+"|"+MOUNTVCS+"|"+CVS+"\n");
439             new JCVSMountAction().perform();
440
441 /* //---Hacking bug #31026---
442     //Checking if it was fixed or not
443     new Action ("Versioning|Mount Version Control", null).performMenu (); //necessery for converting JmenuItem to Jmenu
444     JMenuBarOperator jmbo = MainWindowOperator.getDefault().menuBar();
445     javax.swing.JMenu jm = ((javax.swing.JMenuBar)jmbo.getSource()).getMenu(6); //Should be Versioning
446     log("MainMenu je ... |"+ jm.getText()+"|");
447
448     JMenuOperator jmo = new JMenuOperator(jm);
449     log("jmo ma MenuItem? "+ jmo.getItemCount());
450     
451     int ii = 0;
452     for(int i = 0; i < jmo.getItemCount(); i++) {
453        if(((javax.swing.JMenu)jmo.getSource()).getItem(i) != null) {
454            log( i + " |"+ ((javax.swing.JMenu)jmo.getSource()).getItem(i).getText() +"|");
455            if ( ((javax.swing.JMenu)jmo.getSource()).getItem(i).getText().equals("Mount Version Control") ) ii = i;
456        }
457     }
458     
459     jmo = new JMenuOperator((javax.swing.JMenu) jmo.getItem(ii));
460     log("Menu je ("+ii+") ... |"+ jmo.getText()+"|");
461     log("jmo ma Item? "+ jmo.getItemCount());
462     for(int i = 0 ; i < jmo.getItemCount(); i++) {
463         log(" ... " + i + "|" + jmo.getItem(i).getText());
464     }
465     //End of check
466 */

467             
468 /* log("Trying to push MainMenu:\n"+VERSIONINGMENU+"|"+MOUNTVCS+"\n");
469     final String VERSIONING_MENU1 = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "Menu/Versioning");
470     final String MOUNT_VERSIONING_CONTROL1 = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "CTL_MountActionName");
471     final String CVS_TYPE1 = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
472
473     new ActionNoBlock(VERSIONING_MENU1+"|"+MOUNT_VERSIONING_CONTROL1, null).perform();
474     new ActionNoBlock("Tools", null).perform();
475     
476     org.netbeans.jemmy.Timeout tm = new org.netbeans.jemmy.Timeout("tmpTM", 10000);
477     tm.sleep();
478
479     new JCVSMountAction().perform();
480             //---end of Hack---
481 */

482             
483             
484             NewWizardCVSDialog2 wizardPage1 = new NewWizardCVSDialog2();
485             log("Trying to fill-in the first Panel of Wizard\n");
486             wizardPage1.setWorkingDirectoryTxt(f.getAbsolutePath());
487             wizardPage1.verify();
488             wizardPage1.next();
489             log("Trying to fill-in the second Panel of Wizard\n");
490             NewWizardCVSDialog4 wizardPage2 = new NewWizardCVSDialog4();
491             wizardPage2.setServerName(SERVER);
492             wizardPage2.setUserName(USER);
493             wizardPage2.setRepository(REPOSITORY);
494             wizardPage2.verify();
495             wizardPage2.next();
496             log("Trying to fill-in the third Panel of Wizard\n");
497             NewWizardCVSDialog5 wizardPage3 = new NewWizardCVSDialog5();
498             wizardPage3.verify();
499             wizardPage3.next();
500             log("Trying to fill-in the fourth Panel of Wizard\n");
501             NewWizardCVSDialog6 wizardPage4 = new NewWizardCVSDialog6(SERVER);
502             wizardPage4.verify();
503             wizardPage4.next();
504             log("Trying to fill-in the fifth Panel of Wizard\n");
505             NewWizardCVSDialog6a wizardPage5 = new NewWizardCVSDialog6a();
506             log("Checking up Initial checkout!!!\n");
507             wizardPage5.checkCheckOutACopyOfTheRepositoryFilesToYourWorkingDirectory(true);
508             wizardPage5.verify();
509             wizardPage5.finish();
510
511             log("now the Checkout dilaog should comes up...\n");
512             CheckoutDialog checkout=new CheckoutDialog();
513
514             log("DEADLOCK when invoking 'Select Module' dialog is fixed now,\n"+
515                 "see issue #29464\nhttp://www.netbeans.org/issues/show_bug.cgi?id=29464 ,\n"+
516                 "please if during automat test DEADLOCK occures again, please REOPEN this bug!");
517             
518             log("Trying to open ModuleSelector dialog\n");
519             CheckoutDialog.ModuleChooserDialog chooser=checkout.selectModule();
520             log("Trying to find desired module: "+MODULE);
521             int i=chooser.tabModulesTable().findCellRow(MODULE, new Operator.DefaultStringComparator (true, true));
522             log("Desired module on line "+i+" has been found...selecting it\n");
523             chooser.tabModulesTable().setRowSelectionInterval(i,i);
524             chooser.verify();
525             chooser.ok();
526
527             // instead of it is used typing module into a text field
528
/*
529             checkout.txtCheckout().clearText();
530             checkout.txtCheckout().typeText(MODULE);
531             */

532             
533             checkout.verify();
534             
535             log("The outpuWindow should open now...\n");
536             
537             /* This piece of code is a workaround for problems with losted HierarchyEvent
538              * There is an jemmy's issue http://www.netbeans.org/issues/show_bug.cgi?id=32466
539              * but later appeared as a JDK bug: http://developer.java.sun.com/developer/bugParade/bugs/4924516.html
540              */

541             TabbedOutputOfVCSCommandsFrame out;
542             try {
543                 EventTool.removeListeners();
544                 log("Trying to find and click 'Run command' button\n");
545                 checkout.runCommand();
546                 out = new TabbedOutputOfVCSCommandsFrame();
547             } finally {
548                 EventTool.addListeners();
549             }
550             // end of workaround issue #32466
551

552             
553             endTest();
554             setClassVariable();
555             initHistory(getTestedJavaCVSFS(filesystem)); // just only for this TC. For the rest it is initialized in setUp() method
556

557             out.verify();
558 // endTest();
559

560             log("Trying to find 'Close' button");
561             out.close();
562             log("Closed...\n");
563         } catch (Exception JavaDoc e) {
564             fail(e);
565         }
566     }
567     
568     /** looks for CVS command checkout history record under Explorer's Runtime tab, opens record and tests if "Finished" info is present
569      * @throws Exception any unexpected exception thrown during test
570      * @see #testMount depends on: testMount
571      * @see #testCreateFile <br>next: testCreateFile
572      */

573     public void testHistory() {
574         startTest();
575         String JavaDoc path;
576         String JavaDoc filesystem;
577         CVS = Bundle.getStringTrimmed("org.netbeans.modules.javacvs.Bundle", "JavaCvsFileSystem.validFilesystemLabel");
578         String JavaDoc cmdStatus = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.commands.Bundle", "CTL_Status_Done");
579         boolean isCommandSuccessed;
580         String JavaDoc status;
581         try {
582             path = getJavaCVSWork().getAbsolutePath();
583             filesystem = CVS + path;
584             /*Ask Milos How it's construct the command string which is in RunTime TAB
585              * # RuntimeCommandNode:
586              * # {0} .. Command's display name
587              *The ResourceBundle is: org.netbeans.modules.vcscore.runtime.Bundle
588              *The key is: RuntimeCommandNode.Description=VCS Command ''{0}''
589              *on the line no: 70
590              *
591              *Property-Command name: Checkout
592              *The ResourceBundle is: org.netbeans.modules.javacvs.commands.Bundle
593              *The key is: CvsCheckout.name=Checkout
594              *on the line no: 50
595              */

596             String JavaDoc command = "checkout " + MODULE;
597
598             log("Trying to switch to RunTime TAB via API\n");
599             APICommandsHistory history = new APICommandsHistory(api);
600             
601             log("Creating RunTime TAB Jemmy handler\n");
602             CommandsHistory commandsHistory = new CommandsHistory();
603             
604             log("Verifying if command succeded...");
605             isCommandSuccessed = history.isCommandSuccessed(filesystem, command, cmdStatus);
606             
607             log("Checkin' if command:\n |"+command+"|\non this filesystem:\n "+filesystem+
608                 "\nsuccessed: "+isCommandSuccessed+"\n");
609             Thread.sleep(500L);
610             assertTrue("\nError: cvs command:\n |"+command+
611                 "|\nnode hasn't been found in RunTime TAB under the specified FS:\n "
612                 +filesystem+"|\n", isCommandSuccessed);
613             
614             log("Comparin' command status:\n |" +command+ "|\n |"+ cmdStatus +"|\non this filesystem:\n "+filesystem+"\n");
615             Thread.sleep(500L);
616             assertTrue("\nError: Wrong status of\n|" + command + "|\ncommand.",
617                 commandsHistory.compareStatus(cmdStatus, filesystem, command));
618             
619             log("Comparin' command name:\n |" +command+ "|\non this filesystem:\n "+filesystem+"\n");
620             Thread.sleep(500L);
621             assertTrue("\nError: command name of\n|" + command + "|\ncommand.",
622                 commandsHistory.compareCommandName("Checkout", filesystem, command));
623             
624
625             /* This piece of code is a workaround for problems with losted HierarchyEvent
626              * There is an jemmy's issue http://www.netbeans.org/issues/show_bug.cgi?id=32466
627              * but later appeared as a JDK bug: http://developer.java.sun.com/developer/bugParade/bugs/4924516.html
628              */

629             TabbedOutputOfVCSCommandsFrame out;
630             try {
631                 EventTool.removeListeners();
632                 log("Trying to open output of command...");
633                 out = commandsHistory.viewOutput(filesystem, command);
634             } finally {
635                 EventTool.addListeners();
636             }
637             // end of workaround issue #32466
638

639             log("succeeded, OPENED :)\n");
640             
641             status = Bundle.getString("org.netbeans.modules.vcscore.commands.Bundle", "CommandExitStatus.finished");
642             log("Comparin' statuses in the textfiled:\n |" +status+ "|\n");
643             Thread.sleep(500L);
644             assertTrue("\nError: command status is different from expected value:\n "
645                 +status+"|\n", out.compareStatusTextFld(status));
646             out.verify();
647             
648             log("Trying to find 'Close' button\n");
649             out.close();
650             endTest();
651         } catch (Exception JavaDoc e) {
652             fail(e);
653         }
654     }
655     
656     String JavaDoc getTestFileObjectName() throws IOException {
657         final String JavaDoc file=getTestFile().getName();
658         return file.substring(0,file.lastIndexOf("."));
659     }
660     
661     String JavaDoc getTestDirNodePath() throws IOException {
662         return "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE+"|"+getTestFile().getParentFile().getName();
663     }
664
665     String JavaDoc getTestDirObjectName() throws IOException {
666         return getTestFile().getParentFile().getName();
667     }
668     
669     /** creates new unique testdirectory under workdir, creates new testfile indside and verifies that both are present under Explorer's Filesystems tab with attribute [Local]
670      * @throws Exception any unexpected exception thrown during test
671      * @see #testHistory depends on: testHistory
672      * @see #testAdd <br>next: testAdd
673      */

674     public void testCreateFile() {
675         clearTestStatus();
676         startTest();
677         try {
678 // MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
679

680             log("Trying to find(create) a unique dir/file on a disk: \n"+TESTDIR+", "+getJavaCVSWork()+", "+MODULE+"\n");
681             File f=File.createTempFile(TESTDIR, "", new File(getJavaCVSWork(), MODULE));
682             assertTrue(f.delete());
683             
684             repositoryprefix = "/" + MODULE + "/" + f.getName();
685             log("Trying to make directory: \n"+f.toString()+"\n");
686             assertTrue(f.mkdir());
687             
688             log("Trying to create testing file: "+f+" ,"+TESTFILE+".java\n");
689             setTestFile(new File(f, TESTFILE+".java"));
690             FileOutputStream out = new FileOutputStream(getTestFile());
691             out.write(("class "+TESTFILE+" {}\n").getBytes());
692             
693             log("Trying to close the FileOutputStream\n");
694             out.close();
695
696             log("Trying to open new Explorer and imediately locate and switch to FS TAB...\n");
697             Node rootNode = ExplorerOperator.invoke().repositoryTab().getRootNode();//selectPageFilesystems();
698

699             log("Creating a node on this filesystem:\n" + "CVS "+getJavaCVSWork().getAbsolutePath()+"\n");
700             Node node = new Node(rootNode, "CVS "+getJavaCVSWork().getAbsolutePath());
701             new JCVSRefreshAction().perform(node);
702             
703             log("Creating a node on this filesystem:\n" + "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE+"\n");
704             node = new Node(rootNode, "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE);
705             log("The node is:\n "+ node.getParentPath()+"\n "+node.getPath()+"\n "+node.getText()+"\n "+node.toString()+"\n");
706             log("Trying to go to PopupMenu:\n"+"CVS|Refresh\non this filesystem:\n " + node.getPath() +"\n");
707 /*
708             Operator.DefaultStringComparator comparator = new Operator.DefaultStringComparator(true, true);
709             JMenuBarOperator
710 // MainWindowOperator.getDefault().menuBar ().setDef
711 // Operator.setDefaultStringComparator(comparator);
712             Action ac = new Action(VERSIONINGMENU+"|"+CVS+"|Refresh", "CVS|Refresh");
713             ac.setComparator(comparator);
714             ac.performMenu(node);
715             Operator.setDefaultStringComparator(oldComparator);
716 */

717
718 /* Operator.DefaultStringComparator comparator = new
719             Operator.DefaultStringComparator(true, true);
720             Action ac = new Action("Versioning|CVS|Refresh", null);
721             ac.setComparator(comparator);
722             ac.performMenu(node);
723  */

724             sbt.start();
725             System.out.println("===BACHA!!! REFRESHIM ===");
726             new JCVSRefreshAction().perform(node);
727             sbt.waitText("CVS Client Running Command: Refresh", true);
728             sbt.waitText("Finished: Refresh", true);
729             
730             
731 // exp.tree().callPopupOnPath("CVS|Refresh", "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE);
732
// exp.pushPopupMenu("CVS|Refresh", "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE);
733

734             log("Trying to select a node:\n "+rootNode.getPath() +"\n "+
735                 getTestDirNodePath()+" [Local]|"+getTestFileObjectName()+" [Local]\n");
736             node = new Node(rootNode, getTestDirNodePath()+" [Local]|"+getTestFileObjectName()+" [Local]");
737             node.select();
738             
739 // exp.selectNode(getTestDirNodePath()+" [Local]|"+getTestFileObjectName()+" [Local]");
740
endTest();
741         } catch (Exception JavaDoc e) {
742             fail(e);
743         }
744     }
745     
746     /** invokes Add dialog from testdir's popup menu, runs add command recursively and verifies that testfile has now attributes [LAdded; New] under Explorer
747      * @throws Exception any unexpected exception thrown during test
748      * @see #testCreateFile depends on: testCreateFile
749      * @see #testCommit <br>next: testCommit
750      */

751     public void testAdd() {
752         startTest();
753         try {
754 // Explorer exp=new Explorer();
755
log("Explorer should be opened..\n switching to FS TAB\n");
756 // exp.switchToFilesystemsTab();
757
Node node = new Node(ExplorerOperator.invoke().repositoryTab().getRootNode(),
758                 getTestDirNodePath()+" [Local]");
759             
760             log("Trying to push popup menu 'CVS|Add...' on the node: "+getTestDirNodePath()+" [Local]\n");
761             new JCVSAddAction().perform(node);
762             
763             
764             log("Trying to open Add dialog\n");
765             AddDialog add=new AddDialog();
766             
767             log("Checking up checkBox: 'Recursively'\n");
768             add.check(add.cbRecursively(), true);
769             
770             log("Verifiing the dialog\n");
771             add.verify();
772             
773             log("Trying to push the 'Run Command=OK' buttonn\n");
774             add.runCommand();
775             
776             OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame();
777             log("Verifying the OutputOfCommand dialog\n");
778             out.verify();
779             
780             log("Trying to push the 'Close' button\n");
781             out.close();
782             
783             log("TCs which are founding nodes using fileStatuses will probably fails\n"+
784                 "BECAUSE OF P1 #25987 BUG IN OPENIDE, see http://www.netbeans.org/issues/show_bug.cgi?id=25987");
785             log("Trying to select a file node:\n "+getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]");
786             Thread.sleep(1000L); //Rather wait sometime to give ide a possibility to refresh its nodes...
787
new Node((new RepositoryTabOperator()).getRootNode(),
788                 getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]").select();
789 // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]");
790
log("Selected... :-)\n");
791             endTest();
792         } catch (Exception JavaDoc e) {
793             fail(e);
794         }
795     }
796     
797     /** invokes Commit dialog from testfile's popup menu, runs commit command and verifies that testfile has now attributes [Up-to-date; 1.1] under Explorer
798      * @throws Exception any unexpected exception thrown during test
799      * @see #testAdd depends on: testAdd
800      * @see #testDiff <br>next: testDiff
801      */

802     public void testCommit() {
803         startTest();
804         try {
805 // Explorer exp=new Explorer();
806
log("Trying to switch to FS TAB\n");
807             Node node = new Node(ExplorerOperator.invoke().repositoryTab().getRootNode(),
808                 getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]");
809 // exp.switchToFilesystemsTab();
810

811             log("Trying to push popup menu 'CVS|Commit...' on the node: "+getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]\n");
812             new JCVSCommitAction().perform(node);
813             
814             CommitDialog commit=new CommitDialog();
815             log("verifiing Commit dialog\n");
816             commit.verify();
817             
818             log("Trying to push 'Run Command' button\n");
819             commit.runCommand();
820             
821             OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame();
822             log("verifiing the OutputOfCVSCommand dialog\n");
823             out.verify();
824             
825             log("Trying to push 'Close' button\n");
826             out.close();
827             
828             log("Trying to select a node:\n"+getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]");
829             new Node((new RepositoryTabOperator()).getRootNode(),
830                 getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]").select();
831 // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]");
832
log("Selected... :-)\n");
833             endTest();
834         } catch (Exception JavaDoc e) {
835             fail(e);
836         }
837     }
838     
839     /** changes testfile contents, invokes Refresh command, verifies that testfile has now attributes [LMod; 1.1] under Explorer, invokes diff command from testfile's popup menu and waits for Diff Output frame
840      * @throws Exception any unexpected exception thrown during test
841      * @see #testCommit depends on: testCommit
842      * @see #testVCSGroups <br>next: testVCSGroups
843      */

844     public void testDiff() {
845         startTest();
846         String JavaDoc path;
847         CVS = Bundle.getStringTrimmed("org.netbeans.modules.javacvs.Bundle", "JavaCvsFileSystem.validFilesystemLabel");
848         String JavaDoc filesystem;
849         try {
850              path = getJavaCVSWork().getAbsolutePath();
851              filesystem = CVS + path;
852 // Explorer exp=new Explorer();
853
log("Trying to switch to FS TAB\n");
854             Node rootNode = ExplorerOperator.invoke().repositoryTab().getRootNode();
855             Node node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]");
856 // exp.switchToFilesystemsTab();
857
log("Trying to select a node:\n"+getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]\n");
858 // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]");
859
node.select();
860
861             log("Openning an FileOutputStream using this file:\n"+getTestFile()+"\n");
862             FileOutputStream file = new FileOutputStream(getTestFile());
863             log("Writing a text into it.\n");
864             file.write(("//comment\nclass "+TESTFILE+" {}\n").getBytes());
865             file.close();
866             
867             log("Trying to open PopupMenu:\n'CVS|Refresh' on a node:\n" + getTestDirNodePath()+"\n");
868             node = new Node(rootNode, getTestDirNodePath());
869 // exp.pushPopupMenu("CVS|Refresh", getTestDirNodePath());
870
new JCVSRefreshAction().perform(node);
871
872             MainWindowOperator.getDefault().waitStatusText("Finished: Refresh");
873             
874 // Node rootNode1 = ExplorerOperator.invoke().runtimeTab().getRootNode();
875
// rootNode1.select();
876
/* The folowing block of code is there because I need wait for a node ...
877              * It needs establish after refresh. And it's good for testing stability
878              */

879             rootNode = ExplorerOperator.invoke().repositoryTab().getRootNode();
880             node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName());
881             node.select();
882
883 // log("Trying to open PopupMenu:\n'CVS|Diff...', "+ getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]\n");
884
// node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]");
885
// node = new Node(node, " [LMod; 1.1]");
886

887 // exp.pushPopupMenu("CVS|Diff...", getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]");
888
log("node je...:\n"+node.getPath());
889             node.select();
890             new JCVSDiffAction().perform(node);
891             
892             log("Trying to open dialog for Diff command...\n");
893             DiffDialog diff=new DiffDialog();
894             diff.verify();
895             log("Trying to click on 'Run Command' button...\n");
896             diff.runCommand();
897
898             log("TCs which are test 'Output Of VCS command [' dialogs will probably fails\n"+
899                 "BECAUSE OF P3 #26811 BUG IN CORE, see http://www.netbeans.org/issues/show_bug.cgi?id=26811");
900             log("Opening Diff output window...\n");
901             
902             TopComponentOperator tco = new TopComponentOperator(new EditorWindowOperator (), "Diff testfile.java");
903             dumpDiffGraphical(tco);
904             compareReferenceFiles();
905             
906             tco.undockView();
907             JCVSDiffOutputOperator out = new JCVSDiffOutputOperator("Diff testfile.java", "1.1", "Working File");
908             log("Verifiing if everything is allright on the diff output\n");
909             out.verify();
910             
911             log("Trying to push 'Close' button\n");
912             out.close();
913             endTest();
914         } catch (Exception JavaDoc e) {
915             fail(e);
916         }
917     }
918     
919     void switchToTab(ExplorerOperator expO, String JavaDoc tab) throws Exception JavaDoc {
920         expO.invoke().selectPage(tab);
921     }
922     
923     /** adds testfile to default VCS group using popup menu, invokes VCS Groups frame from Versioning menu, docks it into Explorer, performs Verify, Commit and Delete commands on default group and verifies that testfile has now attributes [Up-to-date; 1.2] under Explorer
924      * @throws Exception any unexpected exception thrown during test
925      * @see #testDiff depends on: testDiff
926      * @see #testVersioningExplorer <br>next: testVersioningExplorer
927      */

928     public void testVCSGroups() {
929         clearTestStatus();
930         startTest();
931         CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
932         String JavaDoc strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JCommitAction") +
933                               Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "ClusteringAction.DialogDots");
934         final String JavaDoc DEFAULTGROUP = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_DefaultGroupName");
935         final String JavaDoc vcsgrpT = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_MODE.title");
936         final String JavaDoc vcsgrpM = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_VcsGroupMenuAction");
937         final String JavaDoc addTovcsGrp = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "LBL_AddToGroupAction");
938         final String JavaDoc verify = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_VerifyGroupAction");
939         final String JavaDoc dialogTitle= Bundle.getStringTrimmed("org.openide.explorer.Bundle", "MSG_ConfirmDeleteObjectTitle");
940         try {
941             log("Trying to get an instance of MainFrame\n");
942 // MainFrame main=MainFrame.getMainFrame();
943
MainWindowOperator main = MainWindowOperator.getDefault();
944             ExplorerOperator exp = new ExplorerOperator();
945             Node rootNode = exp.invoke().repositoryTab().getRootNode();
946             JTreeOperator jtro = null;
947             
948             log("Trying to invoke PopupMenu:\n" + addTovcsGrp +"|"+ DEFAULTGROUP +", on\n"+ getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]\n");
949 // exp.pushPopupMenu(addTovcsGrp+"|"+DEFAULTGROUP, getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]");
950
Node node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]");
951             node.performPopupAction(addTovcsGrp +"|"+ DEFAULTGROUP);
952             
953             log("Trying to push MainMenu:\n"+VERSIONINGMENU+"|" +vcsgrpM+ "\n");
954             
955             new VCSGroupsAction().perform();
956             try { // try is here because VCS Groups frame can be already docked under Explorer
957
log("Realy trying to open VCSGroup Frame\n");
958                 VCSGroupsFrameOperator groups = new VCSGroupsFrameOperator();
959 // VCSGroupsFrame groups = new VCSGroupsFrame();
960
log("Verifying the VCSGroup dialog...\n");
961                 groups.makeComponentVisible();
962                 groups.verify();
963                 Thread.sleep(500);
964                 
965                 log("Trying to invoke MainMenu:\n'Window|Dock View Into|Explorer|Center'\n");
966                 new DockingAction("Explorer|"+DockingAction.CENTER).perform();
967 // main.pushMenuNoExact("Window|Dock View Into|Explorer|Center");
968
} catch (JemmyException ex) {log("Seems that VCSGroup's been already docked in Exp");}
969             
970             log("Trying to switch to VCS Groups TAB\n");
971             //exp=new Explorer();
972
//This probably isn't needed and the construction below seems good enought
973
/* for(int i = 0; i < exp.tbpExplorerTabPane().getTabCount(); i ++){
974                 String sTitle = exp.tbpExplorerTabPane().getTitleAt(i);
975                 if(sTitle.indexOf(vcsgrpT) >= 0) {
976                     exp.selectPage(vcsgrpT);
977                     jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container)
978                         exp.tbpExplorerTabPane().getComponent(i), null, false, false, 0));
979                 }
980             }
981 */

982             exp.selectPage(vcsgrpT);
983             jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container JavaDoc)
984                     exp.tbpExplorerTabPane().getSource (), vcsgrpT, true, true, 0));
985             
986             log("Trying to invoke PopupMenu:\n'Verify', "+" on the\n" + DEFAULTGROUP +"\n");
987             new VerifyGroupAction().perform(new Node(jtro, DEFAULTGROUP));
988             
989             log("Trying to open GroupVerification Dialog....\n");
990             GroupVerificationOperator out = new GroupVerificationOperator();
991             
992             log("Trying to verify the Group dialog...\n");
993             out.verify(false, false, false, false);
994             log("Trying to click on 'Close' button\n");
995             out.close();
996             
997             log("Invoking PopupMenu:\n'"+CVS+ "|" +strCmdAction+"', on "+DEFAULTGROUP+"\n");
998             new JCVSCommitAction().perform(new Node(jtro, DEFAULTGROUP));
999 // exp.pushPopupMenu("CVS|Commit...", DEFAULTGROUP);
1000

1001            log("Commit dialog should appeare\n");
1002// No jelly2 CommitDialogOperator
1003
CommitDialog commit=new CommitDialog();
1004            
1005            log("Verifying the Commit dialog...\n");
1006            commit.verify();
1007            log("Trying to click on 'Run Command' button\n");
1008            commit.runCommand();
1009            
1010            log("...an CommandOutputWindow should open NOW...\n");
1011// No jelly2 CommanOutputWondowOperator
1012
OutputOfVCSCommandsFrame out2=new OutputOfVCSCommandsFrame();
1013            
1014            log("Verifying the Output dialog....\n");
1015            out2.verify();
1016            
1017            log("Trying to click on 'Close' button\n");
1018            out2.close();
1019            
1020            log("Trying to invoke PopupMenu:\n'Delete', "+ DEFAULTGROUP);
1021            strCmdAction = Bundle.getStringTrimmed("org.openide.actions.Bundle", "Delete");
1022            new DeleteAction().perform(new Node(jtro, DEFAULTGROUP));
1023// exp.pushPopupMenu("Delete", DEFAULTGROUP);
1024

1025            log("Answering YES! to the YesNoDialog 'Confirm Object Deletion'...\n");
1026            new NbDialogOperator(dialogTitle).yes();
1027// new JelloYesNoDialog("Confirm Object Deletion").yes();
1028

1029            //exp=new Explorer();
1030
log("...sleeping 1s...\n");
1031            Thread.sleep(1000);
1032            
1033            log("Trying to switch to FS's TAB\n");
1034            rootNode = exp.invoke().repositoryTab().getRootNode();//selectPageFilesystems();
1035

1036            log("Trying to select a node:\n"+getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]\n");
1037// exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]");
1038
node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]");
1039            node.select();
1040            endTest();
1041        } catch (Exception JavaDoc e) {
1042            fail(e);
1043        }
1044    }
1045    
1046    /** invokes Versioning Explorer from testdir's popup menu, docks it into Explorer and looks for "1.1 no message" and "1.2 <Default Group>" nodes under testfile node inside Versioning Explorer
1047     * @throws Exception any unexpected exception thrown during test
1048     * @see #testVCSGroups depends on: testVCSGroups
1049     * @see #testBranch <br>next: testBranch
1050     */

1051    public void testVersioningExplorer() {
1052        startTest();
1053        String JavaDoc versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName");
1054        final String JavaDoc verExplorer= Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "LBL_VersioningExplorer");
1055        try {
1056            log("Trying to get MainFrame...\n");
1057            MainWindowOperator main = MainWindowOperator.getDefault();
1058            ExplorerOperator exp = new ExplorerOperator();
1059            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1060            JTreeOperator jtro = null;
1061
1062            log("Trying to switch to FS's TAB\n");
1063            exp.selectPageFilesystems();
1064            
1065            log("Invoking popup menu 'Versioning Explorer' on a node:\n"+getTestDirNodePath()+"\n");
1066            new VersioningExplorerAction().perform(new Node(rootNode, getTestDirNodePath()));
1067            
1068            try { // try is here because Versioning Explorer can be already docked under Explorer
1069
new VersioningFrameOperator().verify();
1070                log("Trying to dock the Explorer window into Explorer... pushing a MainMenu:\n'Window|Dock View Into|Explorer|Center'\n");
1071                new DockingAction("Explorer|"+DockingAction.CENTER).perform();
1072            } catch (JemmyException ex) {log("Seems that Versioning Expl.'s been already docked in Exp");}
1073            
1074            Thread.sleep(1000);
1075            log("Trying to switch to Versioning TAB\n");
1076            switchToTab(exp, versioning);
1077            jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container JavaDoc)
1078                    exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0));
1079
1080            log("Trying to select a node:\n" + getTestDirNodePath()+"\n");
1081            Node node = new Node(jtro, getTestDirNodePath());
1082            node.select();
1083// exp.selectNode(getTestDirNodePath());
1084

1085            log("Trying to select a node:\n" + getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]\n");
1086// exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]");
1087
node = new Node(node, getTestFileObjectName()+".java [Up-to-date; 1.2]");
1088            node.select();
1089            node.expand();
1090            
1091            /* Checking if there isn't unluckyly "Please wait..." node
1092             */

1093            boolean isPlease = true;
1094            TreePath JavaDoc tp = jtro.findPath(getTestDirNodePath()+"|"+getTestFileObjectName()+".java", "|");
1095            jtro.expandPath(tp);
1096            log("This is TreePath on VE node:\n"+tp+"\n");
1097            while (isPlease) {
1098                for(int i = 0; i < jtro.getChildCount(tp); i++) {
1099                    String JavaDoc please = jtro.getChildPath(tp, i).getLastPathComponent().toString().trim();
1100                    log("This is String node 'Please wait':\n"+please);
1101                    if(please.equals("Please wait...") || please.indexOf("Please wait...")>-1){
1102                        log("There is still 'Please wait...' node.\nWe're waiting another second for refreshing nodes");
1103                        Thread.sleep(1000);
1104                    } else {
1105                        isPlease = false;
1106                    }
1107                }
1108            }
1109            
1110            log("Trying to select a node:\n" + getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]|1.1 no message \n");
1111// exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]|1.1 no message ");
1112
Node tmpNode = node;
1113            node = new Node(node, "1.1 no message ");
1114            node.select();
1115// node.expand();
1116

1117            
1118            log("Trying to select a node:\n" + getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]|1.2 <Default Group> \n");
1119// exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]|1.2 <Default Group> ");
1120
node = new Node(tmpNode, "1.2 <Default Group> ");
1121            node.select();
1122            endTest();
1123            
1124            log("Switching into FS TAB\n");
1125// exp.switchToFilesystemsTab();
1126
exp.selectPageFilesystems();
1127        } catch (Exception JavaDoc e) {
1128            fail(e);
1129        }
1130    }
1131    
1132    /** invokes Tag dialog from testfile's popup menu, creates new branch "vetev2", invokes Refresh Revisions command under Versioning Explorer and looks for "1.2.2 (vetev2)" node inside Versioning Explorer
1133     * @throws Exception any unexpected exception thrown during test
1134     * @see #testVersioningExplorer depends on: testVersioningExplorer
1135     * @see #testUpdateBranch <br>next: testUpdateBranch
1136     */

1137    public void testBranch() {
1138        startTest();
1139        strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JTagAction") +"...";
1140        String JavaDoc versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName");
1141        String JavaDoc refrRev = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.Bundle", "RefreshRevisionsAction_Name");
1142        CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1143        try {
1144            
1145// MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
1146
// MainWindowOperator main = MainWindowOperator.getDefault();
1147
ExplorerOperator exp = new ExplorerOperator();
1148            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1149            JTreeOperator jtro = null;
1150            log("Trying to switch to FS TAB in Explorer\n");
1151            exp.selectPageFilesystems();
1152            
1153            log("Trying to push PopupMe4nu:\n" + CVS +"|"+ strCmdAction +"\non this node:\n"+
1154                getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]\n");
1155            new JCVSTagAction(true).perform(new Node(rootNode,
1156                                getTestDirNodePath()+"|"+ getTestFileObjectName()+" [Up-to-date; 1.2]"));
1157            
1158            log("Trying to open TAG dialog\n");
1159// No jelly2 TagDialogOperator
1160
TagDialog tag=new TagDialog();
1161            
1162            log("Writing text 'vetev2' into tag textfield...\n");
1163            tag.txtTag().setText("vetev2");
1164            
1165            log("Checking up check box for branch tag...\n");
1166            tag.check(tag.cbBranch(), true);
1167            
1168            /* Because of cvsrc file, there could be predefined various command switches
1169             * which we don't know. So we traying to find as much known substring as it is possible
1170             */

1171            log("Trying to find known tag switches: '-b vetev2'\n");
1172            assertTrue("Switches are different!", tag.compareSwitches("tag -"));
1173            assertTrue("Switches are different!", tag.compareSwitches(" -b vetev2"));
1174            
1175            log("Verification TAG dialog....\n");
1176            tag.verify();
1177            
1178            
1179            /* This component isn't used anymore now
1180             * Instead of it is used this one:
1181             * TabbedOutputOfVCSCommandsFrame
1182             */

1183// OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame();
1184

1185            /* This piece of code is a workaround for problems with losted HierarchyEvent
1186             * There is an jemmy's issue http://www.netbeans.org/issues/show_bug.cgi?id=32466
1187             * but later appeared as a JDK bug: http://developer.java.sun.com/developer/bugParade/bugs/4924516.html
1188             */

1189            TabbedOutputOfVCSCommandsFrame out;
1190            try {
1191                EventTool.removeListeners();
1192                log("Trying ot execute command => clickin' on OK button\n");
1193                tag.runCommand();
1194                log("The Output Of VCS Command window should be opened now...\n");
1195                out = new TabbedOutputOfVCSCommandsFrame();
1196            } finally {
1197                EventTool.addListeners();
1198            }
1199            // end of workaround issue #32466
1200

1201            
1202            log("Trying to verify the dialog\n");
1203            //Nefunguje komponenta
1204
// pouzivej TabbedOutputOfVCSCommandsFrame out=new TabbedOutputOfVCSCommandsFrame();
1205
out.verify();
1206            
1207            log("Trying to close the dialog\n");
1208            out.close();
1209            
1210            //exp=new Explorer();
1211
log("Trying to switch to 'Versioning' TAB in the Explorer\n");
1212            switchToTab(exp, versioning);
1213
1214            jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container JavaDoc)
1215                    exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0));
1216            
1217            //Starting listening to MainWindow's status line
1218
sbt.start();
1219            log("Trying to push PopupMenu:\n"+"Refresh Revisions\non the node:\n"+
1220                getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]\n");
1221            
1222            new RefreshRevisionsAction().perform(new Node(jtro,
1223                    getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]"));
1224
1225            log("Trying to find this String 'Finished: Log' in the status line of the MainFrame...\n");
1226            // Will expaire after 60s and throw an Exception if no matching String will be found.
1227
sbt.contains("Finished: Log", true);
1228            sbt.stop();
1229            
1230            new EventTool().waitNoEvent(2000);
1231            log("Trying to select node in the Explorer:\n"+getTestDirNodePath()+"|"+getTestFileObjectName()+
1232                ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)\n");
1233            (new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+
1234                ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)")).select();
1235            
1236            endTest();
1237            log("Trying to switch to FS TAB\n");
1238            exp.selectPageFilesystems();
1239        } catch (Exception JavaDoc e) {
1240            fail(e);
1241        }
1242    }
1243    
1244    /** invokes Update dialog from testfile's popup menu, performs update using Tag "vetev2" and verifies that testfile has now attributes [Up-to-date; 1.2] (vetev2) under Filesystems tab
1245     * @throws Exception any unexpected exception thrown during test
1246     * @see #testBranch depends on: testBranch
1247     * @see #testCommitToBranch <br>next: testCommitToBranch
1248     */

1249    public void testUpdateBranch() {
1250        startTest();
1251        strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JUpdateAction") +"...";
1252        CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1253        try {
1254            ExplorerOperator exp = new ExplorerOperator();
1255            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1256// JTreeOperator jtro = null;
1257

1258            exp.selectPageFilesystems();
1259            new Action(null, CVS +"|"+ strCmdAction).perform(
1260                    new Node(rootNode,getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]"));
1261            
1262// No jelly2 UpdateDialogOperator
1263
UpdateDialog update=new UpdateDialog();
1264            update.check(update.cbRevisionTag(), true);
1265            update.txtRevisionTag().setText("vetev2");
1266            update.check(update.cbRevisionTag(), false);
1267            update.check(update.cbRevisionTag(), true);
1268            /* Because of cvsrc file, there could be predefined various command switches
1269             * which we don't know. So we traying to find as much known substring as it is possible
1270             */

1271            assertTrue("Switches are different!", update.compareSwitches("update -")); assertTrue("Switches are different!", update.compareSwitches(" -r vetev2"));
1272            
1273            update.verify();
1274            update.runCommand();
1275// No jelly2 OutputOfVCSCommandsFrameOperator
1276
OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame();
1277            out.verify();
1278            out.close();
1279            new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2] (vetev2)").select();
1280            endTest();
1281        } catch (Exception JavaDoc e) {
1282            fail(e);
1283        }
1284    }
1285    
1286    /** changes testfile contents again, invokes Refresh command, verifies that testfile has now attributes [LMod; 1.2] (vetev2), invokes Commit command from testfile's popup menu, verifies that testfile has now attributes [Up-to-date; 1.2.2.1] (vetev2), performs Refresh Revissions command under Revision Expplorer and looks for "1.2.2.1 no message" node inside
1287     * @throws Exception any unexpected exception thrown during test
1288     * @see #testUpdateBranch depends on: testUpdateBranch
1289     * @see #testMerge <br>next: testMerge
1290     */

1291    public void testCommitToBranch() {
1292        startTest();
1293        strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JRefreshAction");
1294        String JavaDoc commitcmd= Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JCommitAction") + "...";
1295        String JavaDoc versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName");
1296        String JavaDoc refrRev = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.Bundle", "RefreshRevisionsAction_Name");
1297        CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1298        try {
1299            ExplorerOperator exp = new ExplorerOperator();
1300            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1301// MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
1302
Node node = null;
1303            JTreeOperator jtro = null;
1304
1305            log("Trying to switch to FS Tab\n");
1306            exp.selectPageFilesystems();
1307            
1308            log("Trying to select this node:\n"+
1309                getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2] (vetev2)");
1310            new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2] (vetev2)").select();
1311
1312
1313            FileOutputStream file = new FileOutputStream(getTestFile());
1314            file.write(("//comment\nclass "+TESTFILE+" {\n//branch vetev2\n}\n").getBytes());
1315            file.close();
1316            
1317            log("Trying to push PopupMenu:\n"+ CVS +"|"+ strCmdAction +"\non the node:\n"+ getTestDirNodePath()+"\n");
1318            new JCVSRefreshAction().perform(new Node(rootNode, getTestDirNodePath()));
1319            
1320            log("Trying to push PopupMenu:\n"+ CVS +"|"+ commitcmd +"\non the node:\n"+
1321                getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.2] (vetev2)\n");
1322            new JCVSCommitAction().perform(
1323                new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.2] (vetev2)"));
1324            
1325            log("Opening the Commit dialog...\n");
1326// No jelly2 CommitDialogOperator
1327
CommitDialog commit=new CommitDialog();
1328            
1329            log("Trying to verify the dialog...\b");
1330            commit.verify();
1331            
1332            log("Executing the command...\n");
1333            commit.runCommand();
1334            
1335            log("Opening the 'Output of VCS Commands [' dialog...\n");
1336            OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame();
1337            
1338            log("Verifying the dialog...\n");
1339            out.verify();
1340            
1341            log("Closing t dialog...\n");
1342            out.close();
1343            
1344            log("Trying to select a node:\n"+
1345                getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2.2.1] (vetev2)\n");
1346            new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2.2.1] (vetev2)").select();
1347            
1348            log("Trying to switch to Verifying TAB\n");
1349            switchToTab(exp, versioning);
1350            jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container JavaDoc)
1351                exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0));
1352            
1353            log("Selecting a node:\n" +getTestDirNodePath());
1354            node = new Node(jtro, getTestDirNodePath());
1355            node.select();
1356            
1357            sbt.start();
1358            log("Trying to push PopupMenu:\n" + refrRev + "\non the node:\n"+
1359                getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2.2.1] (vetev2)+\n");
1360            
1361            node = new Node(node, getTestFileObjectName()+".java [Up-to-date; 1.2.2.1] (vetev2)");
1362            
1363            new RefreshRevisionsAction().perform(node);
1364            
1365            log("Verifying status line in MainFrame...'Finished: Log'\n");
1366            sbt.waitText("Finished: Log");
1367            sbt.stop();
1368
1369            /* Waiting for creating node after LOG command in VE */
1370            try {
1371                new Waiter(new Waitable() {
1372                    public Object JavaDoc actionProduced(Object JavaDoc parent) {
1373                        return new Node((Node)parent, "1.2|1.2.2 (vetev2)").isChildPresent("1.2.2.1") ? Boolean.TRUE: null;
1374                    }
1375                    public String JavaDoc getDescription() {
1376                        return("Child '1.2.2 (vetev2)' present under parent '1.2 <Default Group> '");
1377                    }
1378                }).waitAction(node);
1379            } catch (InterruptedException JavaDoc e) {
1380                throw new JemmyException("Interrupted.", e);
1381            }
1382
1383            
1384            log("Selecting node:\n"+ getTestDirNodePath()+"|"+getTestFileObjectName()+
1385                ".java [Up-to-date; 1.2.2.1] (vetev2)|1.2 <Default Group> |1.2.2 (vetev2)|1.2.2.1 no message \n");
1386            
1387            
1388            node = new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+
1389                ".java [Up-to-date; 1.2.2.1] (vetev2)|1.2 <Default Group> |1.2.2 (vetev2)|1.2.2.1 no message ");
1390            log("Selected node should be:\n"+node.getPath());
1391            
1392            
1393            node.select();
1394            endTest();
1395            
1396            log("Trying to switch to FS TAB\n");
1397            exp.selectPageFilesystems();
1398        } catch (Exception JavaDoc e) {
1399            fail(e);
1400        }
1401    }
1402    
1403    /** performs update of testfile with Reset Sticky option, verifies that testfile has now [Up-to-date; 1.2] attributes, swithes to Revision Explorer, performs Merge With Revision command on "1.2.2 (vetev2)" node, verifies that testfile has now [LMod; 1.2] attributes, performs Commit command on testfile's node and verifies that testfile has now [Up-to-date; 1.3] attributes
1404     * @throws Exception any unexpected exception thrown during test
1405     * @see #testCommitToBranch depends on: testCommitToBranch
1406     * @see #testStatus <br>next: testStatus
1407     */

1408    public void testMerge() {
1409        startTest();
1410        strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JUpdateAction") +"...";
1411        String JavaDoc versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName");
1412        String JavaDoc merge = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.versioning.Bundle", "JavaCvsVersioningAction.merge");
1413        String JavaDoc commitCmd = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JCommitAction") + "...";
1414        CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1415        try {
1416            ExplorerOperator exp = new ExplorerOperator();
1417            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1418// MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
1419
JTreeOperator jtro = null;
1420            
1421            log("Trying to switch to FS Tab\n");
1422            exp.selectPageFilesystems();
1423            
1424            log("Trying to push PopupMenu:\n" +CVS+ "|" +strCmdAction+ "\non the node:\n"+
1425                getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2.2.1] (vetev2)\n");
1426            new JCVSUpdateAction().perform(
1427                new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2.2.1] (vetev2)"));
1428            
1429            log("Opening Update dialog...\n");
1430// No jelly2 UpdateDialogOperator
1431
UpdateDialog update=new UpdateDialog();
1432            
1433            log("Trying to 'reset sticky tag'...\n");
1434            update.check(update.cbResetSticky(), true);
1435            
1436            log("Trying to verify the dialog...\n");
1437            update.verify();
1438            
1439            log("Executing command....\n");
1440            update.runCommand();
1441            
1442            log("The 'Output of VCS Commands [' should be opened...\n");
1443// No jelly2 UpdateDialogOperator
1444
OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame();
1445            log("Trying to verify the dialog\n");
1446            out.verify();
1447            log("Trying to close the dialog using 'Close' button\n");
1448            out.close();
1449            
1450            log("Trying to select node in the explorer:\n"+
1451                getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]");
1452            new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]").select();
1453
1454            //exp=new Explorer();
1455
log("Trying to switch to Versioning TAB\n");
1456            switchToTab(exp, versioning);
1457            jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container JavaDoc)
1458                  exp.tbpExplorerTabPane().getSource(), versioning, true, true, 0));
1459
1460            sbt.start();
1461            log("Trying to push PopupMenu:\n" +merge+ "\non the node in VE:\n"+ getTestDirNodePath()+"|"+
1462                getTestFileObjectName()+".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)");
1463            new JCVSMergeWithRevisionAction().perform(new Node
1464                (jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+ ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)"));
1465
1466//Please correct text which is compaered in statusline after merge!!!!
1467
log("WARNING TO DEVELOPERS:\nPlease correct 'mergre' text in status line o MainWindow!!!");
1468            System.out.println("Jaky je text v Main Window status Line?");
1469            System.out.println(sbt.getStatusTextHistory().toString());
1470            sbt.contains("Merge:finished...", true);
1471            sbt.stop();
1472            
1473            log("Merge With Revision seems succeeded...\n");
1474
1475            log("Trying to push PopupMenu:\n"+ CVS +"|"+ commitCmd +"\non the node:\n"+
1476                getTestDirNodePath()+"|"+getTestFileObjectName()+".java [LMod; 1.2]");
1477            new JCVSCommitAction().perform(new Node
1478                (jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [LMod; 1.2]"));
1479            
1480            log("Invoking Commit dialog");
1481// No jelly2 CommitDialogOperator
1482
CommitDialog commit=new CommitDialog();
1483            
1484            log("Typing a message:\nMerged with branch.\n");
1485            commit.txtMessage().setText("Merged with branch.");
1486            
1487            log("Trying to verify the dialog\n");
1488            commit.verify();
1489            
1490            log("Trying to execute the command\n");
1491            commit.runCommand();
1492            
1493            log("Invoking the 'Ouptut of VCS Commands [' dialog\n");
1494            out=new OutputOfVCSCommandsFrame();
1495            
1496            log("Trying to verify the dialog\n");
1497            out.verify();
1498            
1499            log("Closing the dialog\n");
1500            out.close();
1501            
1502            log("Selecting a node:\n"+
1503                getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]\n");
1504            new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]").select();
1505            endTest();
1506            
1507            log("Trying to switch to FS Tab\n");
1508            exp.selectPageFilesystems();
1509        } catch (Exception JavaDoc e) {
1510            fail(e);
1511        }
1512    }
1513    
1514    /** performs Status command on testfile and looks for "Up-to-date" and "1.3" labels inside output frame
1515     * @throws Exception any unexpected exception thrown during test
1516     * @see #testMerge depends on: testMerge
1517     * @see #testLog <br>next: testLog
1518     */

1519    public void testStatus() {
1520        startTest();
1521        strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JStatusAction") +"...";
1522        String JavaDoc versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName");
1523        CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1524        try {
1525            ExplorerOperator exp=new ExplorerOperator();
1526            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1527// MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
1528
Node node = null;
1529            JTreeOperator jtro = null;
1530
1531            log("Trying to switch to Versioning TAB\n");
1532            switchToTab(exp, versioning);
1533            
1534            log("Trying to push PopupMenu:\n"+ CVS +"|"+ strCmdAction +"\non the node:\n"+
1535                getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]\n");
1536            jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container JavaDoc)
1537                  exp.tbpExplorerTabPane().getSource(), versioning, true, true, 0));
1538            new JCVSStatusAction().perform(new Node
1539                (jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]"));
1540            
1541            log("Invoking command dialog...\n");
1542// No jelly2 StatusDialogOperator
1543
StatusDialog dlg=new StatusDialog();
1544            
1545            log("Verifying the dialog...\n");
1546            dlg.verify();
1547            
1548            log("Executing the command...\n");
1549            dlg.runCommand();
1550            
1551            log("Looking for 'CVS Output [Status - testfile.java]' dialog....\nbut sometimes it might happen"+
1552                "that command name and file is ommited:-((((...In this case...\n test would fail\nsee P2 #26842 bug at: "+
1553                "http://www.netbeans.org/issues/show_bug.cgi?id=26842\nand write your experiences in to it, please:\n");
1554            StatusOutputOperator out=new StatusOutputOperator("testfile.java");
1555            
1556            log("Status output dialog contains:");
1557            log(out.getStatus());
1558            log(out.getFilename());
1559            log(out.getRepositoryFile());
1560            log(out.getWorkingRevision());
1561            log(out.getRepositoryRevision());
1562            log(out.getStickyTag());
1563            log(out.getStickyOptions()+"\n");
1564            
1565            log("psRef="+psRef.toString());
1566            log("repositoryprefix="+repositoryprefix);
1567            out.dumpFile(psRef, repositoryprefix);
1568            out.close();
1569            compareReferenceFiles();
1570            
1571            log("Trying to switch to FS Tab\n");
1572            exp.selectPageFilesystems();
1573            endTest();
1574        } catch (Exception JavaDoc e) {
1575            fail(e);
1576        }
1577    }
1578    
1579    /** performs Log command on testfile and looks for "1.3" label inside output frame
1580     * @throws Exception any unexpected exception thrown during test
1581     * @see #testStatus depends on: testStatus
1582     * @see #testAnnotate <br>next: testAnnotate
1583     */

1584    public void testLog() {
1585        clearTestStatus();
1586        startTest();
1587        strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JLogAction") +"...";
1588        String JavaDoc versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName");
1589        CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1590        try {
1591            ExplorerOperator exp=new ExplorerOperator();
1592            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1593            Node node = null;
1594            JTreeOperator jtro = null;
1595            
1596            log("Trying to switch to Verifying TAB\n");
1597            switchToTab(exp, versioning);
1598            
1599            jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container JavaDoc)
1600                    exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0));
1601            node = new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]");
1602
1603            log("Trying to push PopupMenu:\n"+ CVS +"|"+ strCmdAction +"\non the node:\n" + node.getPath());
1604            new JCVSLogAction().perform(node);
1605            
1606            log("Opening the input dialog for log command...\n");
1607// No jelly2 LogDialogOperator
1608
LogDialog dlg=new LogDialog();
1609            
1610            log("Verifying the dialog...\n");
1611            dlg.verify();
1612            
1613            log("Exception the command...\n");
1614            dlg.runCommand();
1615
1616            log("Looking for 'CVS Output [Log - testfile.java]' dialog....\nbut sometimes it might happen"+
1617                "that command name and file is ommited:-((((...In this case...\n test would fail\nsee P2 bug at: "+
1618                "http://www.netbeans.org/issues/show_bug.cgi?id=26842\nand write your experiences in to it, please:\n");
1619            LogOutputOperator out=new LogOutputOperator("testfile.java", false, false);
1620            
1621            log("Log output dialog contains:");
1622            log(out.getFilename());
1623            log(out.getLocks());
1624            log(out.getRepositoryFile());
1625            log(out.getHeadRevision());
1626            log(out.getSelectedRevisions());
1627            log(out.getOutOf());
1628            log(out.getLogMessage()+"\n");
1629
1630            log("psRef="+psRef.toString());
1631            log("repositoryprefix="+repositoryprefix);
1632            out.dumpFile(psRef, repositoryprefix);
1633            compareReferenceFiles();
1634            
1635            log("Closing the dialog...\n");
1636            out.close();
1637            endTest();
1638            
1639            log("Trying to switch to FS TAB\n");
1640            exp.selectPageFilesystems();
1641        } catch (Exception JavaDoc e) {
1642            fail(e);
1643        }
1644    }
1645    
1646    /** performs Annotate command on testfile and looks for output
1647     * @throws Exception any unexpected exception thrown during test
1648     * @see #testLog depends on: testLog
1649     * @see #testUnmount <br>next: testUnmount
1650     */

1651        public void testAnnotate() {
1652        clearTestStatus();
1653        startTest();
1654        strCmdAction = Bundle.getStringTrimmed("org.netbeans.modules.cvsclient.actions.Bundle", "LBL_JAnnotateAction") +"...";
1655        String JavaDoc versioning = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName");
1656        CVS = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1657        try {
1658            ExplorerOperator exp=new ExplorerOperator();
1659            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1660            Node node = null;
1661            JTreeOperator jtro = null;
1662
1663            log("Trying to switch to Versioning TAB\n");
1664            switchToTab(exp, versioning);
1665            
1666            log("Trying to push PopupMenu:\n"+ CVS +"|"+ strCmdAction +"\non the node:\n"+
1667                getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]");
1668
1669            jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container JavaDoc)
1670                    exp.tbpExplorerTabPane().getSource (), versioning, true, true, 0));
1671            new JCVSAnnotateAction().perform(
1672                new Node(jtro, getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.3]"));
1673            
1674            log("Opening the input command dialog...\n");
1675// No jelly2 AnnotateDialogOperator
1676
AnnotateDialog dlg=new AnnotateDialog();
1677            
1678            log("Trying to verify the dialog...\n");
1679            dlg.verify();
1680            
1681            log("Explorer the log command...\n");
1682            dlg.runCommand();
1683            
1684            log("Looking for 'CVS Output [Annotate - testfile.java]' dialog.... and traying it to close,\nbut sometimes it might happen"+
1685                "that command name and file is ommited:-((((...In this case...\n test would fail\nsee P2 bug at: "+
1686                "http://www.netbeans.org/issues/show_bug.cgi?id=26842\nand write your experiences in to it, please:\n");
1687            new FrameOperator("CVS Output [Annotate testfile.java]").close();
1688            endTest();
1689            
1690            log("Trying to switch to FS TAB\n");
1691            exp.selectPageFilesystems();
1692        } catch (Exception JavaDoc e) {
1693            fail(e);
1694        }
1695    }
1696    
1697    /** unmounts CVS filesystem using its popup menu
1698     * @throws Exception any unexpected exception thrown during test
1699     * @see #testAnnotate depends on: testAnnotate
1700     * @see #testUndock <br>next: testUndock
1701     */

1702    public void testUnmount() {
1703        clearTestStatus();
1704        startTest();
1705        CVS = Bundle.getStringTrimmed("org.netbeans.modules.javacvs.Bundle", "JavaCvsFileSystem.validFilesystemLabel");
1706        String JavaDoc umountFS = Bundle.getStringTrimmed("org.netbeans.core.actions.Bundle", "UnmountFS");
1707        try {
1708            ExplorerOperator exp=new ExplorerOperator();
1709            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1710            Node node = null;
1711// JTreeOperator jtro = null;
1712

1713            log("Trying to get focus to Explorer\n");
1714            exp.getFocus();
1715            
1716// log("Trying to switch to FileSystems TAB");
1717
// exp.selectPageFilesystems();
1718

1719            node = new Node(rootNode, CVS + getJavaCVSWork().getAbsolutePath());
1720            log("Trying to push PopupMenu:\n"+umountFS+"\non the node:\n"+node+"\n");
1721            new UnmountFSAction().perform(node);
1722            log("DONE:)");
1723            endTest();
1724        } catch (Exception JavaDoc e) {
1725            fail(e);
1726        }
1727    }
1728    
1729    /** undocks VCS Groups and Versioning frames from Explorer and closes them
1730     * @throws Exception any unexpected exception thrown during test
1731     * @see #testUnmount depends on: testUnmount
1732     */

1733    public void testUndock() {
1734        clearTestStatus();
1735        startTest();
1736        String JavaDoc vcsGrpTAB = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.grouping.Bundle", "LBL_MODE.title");
1737        String JavaDoc versTAB = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.versioning.impl.Bundle", "versioningSystemName");
1738        try {
1739            ExplorerOperator exp=new ExplorerOperator();
1740            Node rootNode = exp.invoke().repositoryTab().getRootNode();
1741            Node node = null;
1742// JTreeOperator jtro = null;
1743
JFrameOperator jfo = null;
1744
1745            log("Trying to activate the Explorer...\n");
1746            exp.getFocus();
1747            //Excersising with the Explorer to correctly undock VCS Groups TAB
1748
Thread.sleep(2500);
1749            
1750            log("Trying to switch to FS TAB\n");
1751            exp.selectPageFilesystems();
1752            //Excersising with the Explorer to correctly undock VCS Groups TAB
1753
Thread.sleep(2500);
1754            
1755            log("Trying to switch to '" +vcsGrpTAB+ "' TAB\n");
1756            switchToTab(exp, vcsGrpTAB);
1757            
1758            log("Trying to push MainMenu:\"+ 'Window||Undock View'\n");
1759// MainWindowOperator.getDefault();
1760
new UndockAction().perform();
1761            
1762            log("...now the VCSGroupFrame should be undock....and we'return closing it...\n");
1763            new VCSGroupsFrameOperator().close();
1764            
1765            //exp=new Explorer();
1766
log("Trying to activate the Explorer...\n");
1767// new JFrameOperator(exp.getJFrame()).activate();
1768
exp.getFocus();
1769            
1770            log("Trying to switch to '" +versTAB+ "' TAB\n");
1771            switchToTab(exp, versTAB);
1772// MainFrame.getMainFrame().pushMenu("Window|Undock View");
1773
new UndockAction().perform();
1774            new VersioningFrameOperator().close();
1775            endTest();
1776        } catch (Exception JavaDoc e) {
1777            fail(e);
1778        }
1779    }
1780}
1781
Popular Tags