0001: /*
0002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003: *
0004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005: *
0006: * The contents of this file are subject to the terms of either the GNU
0007: * General Public License Version 2 only ("GPL") or the Common
0008: * Development and Distribution License("CDDL") (collectively, the
0009: * "License"). You may not use this file except in compliance with the
0010: * License. You can obtain a copy of the License at
0011: * http://www.netbeans.org/cddl-gplv2.html
0012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013: * specific language governing permissions and limitations under the
0014: * License. When distributing the software, include this License Header
0015: * Notice in each file and include the License file at
0016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
0017: * particular file as subject to the "Classpath" exception as provided
0018: * by Sun in the GPL Version 2 section of the License file that
0019: * accompanied this code. If applicable, add the following below the
0020: * License Header, with the fields enclosed by brackets [] replaced by
0021: * your own identifying information:
0022: * "Portions Copyrighted [year] [name of copyright owner]"
0023: *
0024: * Contributor(s):
0025: *
0026: * The Original Software is NetBeans. The Initial Developer of the Original
0027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
0028: * Microsystems, Inc. All Rights Reserved.
0029: *
0030: * If you wish your version of this file to be governed by only the CDDL
0031: * or only the GPL Version 2, indicate your decision by adding
0032: * "[Contributor] elects to include this software in this distribution
0033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034: * single choice of license, a recipient has the option to distribute
0035: * your version of this file under either the CDDL, the GPL Version 2 or
0036: * to extend the choice of license to its licensees as provided above.
0037: * However, if you add GPL Version 2 code and therefore, elected the GPL
0038: * Version 2 license, then the option applies only if the new code is
0039: * made subject to such option by the copyright holder.
0040: */
0041:
0042: /*
0043: * JavaCVSValidationTest.java
0044: *
0045: * Created on December 12, 2001, 11:09 AM
0046: * Last Update: $Date$
0047: */
0048:
0049: package validation;
0050:
0051: import java.awt.Color;
0052: import java.awt.Container;
0053: import java.lang.reflect.Method;
0054: import java.io.*;
0055: import java.util.Enumeration;
0056: import java.util.Properties;
0057: import java.util.Set;
0058: import javax.swing.text.Style;
0059: import javax.swing.text.StyledDocument;
0060: import javax.swing.text.StyleConstants.ColorConstants;
0061: import javax.swing.tree.TreePath;
0062: import junit.framework.*;
0063:
0064: //import org.netbeans.jemmy.*;
0065: import org.netbeans.jemmy.EventTool;
0066: import org.netbeans.jemmy.JemmyProperties;
0067: import org.netbeans.jemmy.TestOut;
0068: import org.netbeans.jemmy.JemmyException;
0069: import org.netbeans.jemmy.operators.*;
0070: import org.netbeans.jemmy.util.PNGEncoder;
0071: import org.netbeans.junit.*;
0072:
0073: // New Jelly2 lib
0074: import org.netbeans.jellytools.*;
0075: import org.netbeans.jellytools.actions.*;
0076: import org.netbeans.jellytools.nodes.*;
0077: import org.netbeans.jellytools.properties.*;
0078: import org.netbeans.jellytools.modules.javacvs.actions.*;
0079: import org.netbeans.jellytools.modules.javacvs.output.JCVSDiffOutputOperator;
0080: import org.netbeans.jellytools.modules.javacvs.output.LogOutputOperator;
0081: import org.netbeans.jellytools.modules.javacvs.output.StatusOutputOperator;
0082: import org.netbeans.jellytools.modules.vcscore.actions.*;
0083: import org.netbeans.jellytools.modules.vcscore.VCSGroupsFrameOperator;
0084: import org.netbeans.jellytools.modules.vcscore.VersioningFrameOperator;
0085: import org.netbeans.jellytools.modules.vcscore.GroupVerificationOperator;
0086: import org.netbeans.jemmy.Waitable;
0087: import org.netbeans.jemmy.Waiter;
0088:
0089: //import org.netbeans.jellytools.properties.editors.*;
0090: //import org.netbeans.jellytools.modules.javacvs.*;
0091:
0092: // Old Jelly lib
0093: //import org.netbeans.test.oo.gui.jam.*;
0094: //import org.netbeans.test.oo.gui.jello.*;
0095: //import org.netbeans.test.oo.gui.jelly.*;
0096: import org.netbeans.test.oo.gui.jelly.vcscore.*; //import org.netbeans.test.oo.gui.jelly.vcscore.wizard.*;
0097: import org.netbeans.test.oo.gui.jelly.javacvs.*;
0098:
0099: import org.openide.options.SystemOption;
0100: import org.netbeans.modules.cvsclient.JavaCvsSettings;
0101: import org.openide.filesystems.FileSystem;
0102: import org.openide.filesystems.Repository;
0103:
0104: /** XTest / JUnit test class performing validation of JavaCVS module
0105: *
0106: * @author <a href="mailto:adam.sotona@sun.com">Adam Sotona</a>
0107: * @see #suite JavaCVS validation testsuite definition
0108: * @version 1.0
0109: */
0110: public class JavaCVSValidationTest extends JellyTestCase {
0111:
0112: static util.History his;
0113: static String path;
0114: static String repositoryprefix;
0115: static String CVSlbl = Bundle.getStringTrimmed(
0116: "org.netbeans.modules.javacvs.Bundle",
0117: "JavaCvsFileSystem.validFilesystemLabel");
0118: static String filesystem;
0119: static FileSystem testedJavaCVSFS;
0120:
0121: /* Site specific properties */
0122: final String SERVER = System.getProperty("SERVER");
0123: final String REPOSITORY = System.getProperty("REPOSITORY");
0124: final String SERVERTYPE = System.getProperty("SERVERTYPE");
0125: final String USER = System.getProperty("USER");
0126: final String PASSWORD = System.getProperty("PASSWORD");
0127: final String PORT = System.getProperty("PORT");
0128: final String MODULE = System.getProperty("MODULE");
0129:
0130: static final String WORKDIR = "JavaCVSwork";
0131: static final String TESTDIR = "testdir";
0132: static final String TESTFILE = "testfile";
0133: static final String TESTFILEPROPERTY = "javacvs.validation.test.file";
0134:
0135: static final String VERSIONINGMENU = Bundle.getStringTrimmed(
0136: "org.netbeans.modules.vcscore.actions.Bundle",
0137: "Menu/Versioning");
0138: static final String MOUNTVCS = Bundle.getStringTrimmed(
0139: "org.netbeans.modules.vcscore.actions.Bundle",
0140: "CTL_MountActionName");
0141: static String CVS = Bundle
0142: .getStringTrimmed(
0143: "org.netbeans.modules.vcscore.wizard.mountcvs.Bundle",
0144: "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
0145: static String strCmdAction;
0146: static File testFile = null;
0147: static MainWindowOperator.StatusTextTracer sbt = MainWindowOperator
0148: .getDefault().getStatusTextTracer();
0149:
0150: static final boolean capture = true;
0151: PrintStream psRef;
0152: PrintStream ps;
0153: // PrintStream pstreams [] = {ps , psRef}; it's not neccessary anymore. See tearDown()
0154:
0155: APIController api;
0156:
0157: /** store previously used comparator
0158: */
0159: Operator.StringComparator oldComparator = Operator
0160: .getDefaultStringComparator();
0161:
0162: /** constructor required by JUnit
0163: * @param testName method name to be used as testcase
0164: */
0165: public JavaCVSValidationTest(String testName) {
0166: super (testName);
0167: }
0168:
0169: /** method used for explicit testsuite definition<br>
0170: * JavaCVS validation suite is order-sensitive <br>
0171: * Contains also <i>commented</i> TRY-CATCH BLOCK
0172: * with set longer timeouts. This should be uncommented
0173: * on slower machines.
0174: *
0175: *
0176: * @return JavaCVS validation testsuite
0177: * @see #testConnectionManager 1.testConnectionManager
0178: * @see #testMount <br>2.testMount
0179: * @see #testHistory <br>3.testHistory
0180: * @see #testCreateFile <br>4.testCreateFile
0181: * @see #testAdd <br>5.testAdd
0182: * @see #testCommit <br>6.testCommit
0183: * @see #testDiff <br>7.testDiff
0184: * @see #testVCSGroups <br>8.testVCSGroups
0185: * @see #testVersioningExplorer <br>9.testVersioningExplorer
0186: * @see #testBranch <br>10.testBranch
0187: * @see #testUpdateBranch <br>11.testUpdateBranch
0188: * @see #testCommitToBranch <br>12.testCommitToBranch
0189: * @see #testMerge <br>13.testMerge
0190: * @see #testStatus <br>14.testStatus
0191: * @see #testLog <br>15.testLog
0192: * @see #testAnnotate <br>16.testAnnotate
0193: * @see #testUnmount <br>17.testUnmount
0194: * @see #testUndock <br>18.testUndock
0195: */
0196: public static junit.framework.Test suite() {
0197: TestSuite suite = new NbTestSuite();
0198: suite
0199: .addTest(new JavaCVSValidationTest(
0200: "testConnectionManager"));
0201: suite.addTest(new JavaCVSValidationTest("testMount"));
0202: suite.addTest(new JavaCVSValidationTest("testHistory"));
0203: suite.addTest(new JavaCVSValidationTest("testCreateFile"));
0204: suite.addTest(new JavaCVSValidationTest("testAdd"));
0205: suite.addTest(new JavaCVSValidationTest("testCommit"));
0206: suite.addTest(new JavaCVSValidationTest("testDiff"));
0207: suite.addTest(new JavaCVSValidationTest("testVCSGroups"));
0208: suite.addTest(new JavaCVSValidationTest(
0209: "testVersioningExplorer"));
0210: suite.addTest(new JavaCVSValidationTest("testBranch"));
0211: suite.addTest(new JavaCVSValidationTest("testUpdateBranch"));
0212: suite.addTest(new JavaCVSValidationTest("testCommitToBranch"));
0213: suite.addTest(new JavaCVSValidationTest("testMerge"));
0214: suite.addTest(new JavaCVSValidationTest("testStatus"));
0215: suite.addTest(new JavaCVSValidationTest("testLog"));
0216: suite.addTest(new JavaCVSValidationTest("testAnnotate"));
0217: suite.addTest(new JavaCVSValidationTest("testUnmount"));
0218: suite.addTest(new JavaCVSValidationTest("testUndock"));
0219: return suite;
0220: }
0221:
0222: /** Use for internal test execution inside IDE
0223: * @param args command line arguments
0224: */
0225: public static void main(java.lang.String[] args) throws IOException {
0226: /* Execution Xtestu using ANT
0227: ant -Dxtest.userdata.propertyfile=/home.local/danielm/cvs/ide/javacvs/test/qa-functional/src/site-specific/JavaCVSValidationTest_home.properties
0228: */
0229:
0230: /* Preparing xtest.userdate properties for internal usage
0231: */
0232: InputStream inStream = JavaCVSValidationTest.class
0233: .getResourceAsStream("/site-specific/JavaCVSValidationTest_home.properties");
0234: Properties pro = System.getProperties();
0235: pro.load(inStream);
0236: Set set = pro.keySet();
0237: String[] str = (String[]) set.toArray(new String[set.size()]);
0238:
0239: if (str != null)
0240: for (int i = 0; i < str.length; i++)
0241: if (str[i].startsWith("xtest.userdata"))
0242: System.setProperty(str[i].substring(str[i]
0243: .indexOf('|') + 1), System
0244: .getProperty(str[i]));
0245: pro.list(System.out);
0246:
0247: junit.textui.TestRunner.run(suite());
0248: }
0249:
0250: /** method called before each testcase<br>
0251: * sets long Jemmy WaitComponentTimeout and switches JavaCVS UI mode
0252: */
0253: protected void setUp() {
0254: new EventTool().waitNoEvent(2000);
0255: System.out.println(getName());
0256: ((JavaCvsSettings) SystemOption.findObject(
0257: JavaCvsSettings.class, true)).setUiMode(1);
0258: // JellyProperties.setJemmyDebugTimeouts();
0259: JemmyProperties.setCurrentTimeout(
0260: "ComponentOperator.WaitComponentTimeout", 20000);
0261: api = new APIController();
0262: api.setOut(new PrintWriter(System.out, true));
0263: //api.setOut (new PrintWriter (getLog(), true));
0264: ps = getLog("jemmy.log");
0265: psRef = getRef();
0266:
0267: // JellyProperties.setJemmyOutput(new PrintWriter(ps, true), new PrintWriter(ps, true));
0268: JemmyProperties.getCurrentOutput().setAutoFlushMode(true);
0269:
0270: /* Seems that Robot dispatching is not safe on my linux (RedHat7.1, KDE2.1.1)
0271: * Test usualy fails at testMount() method when pushMenuNoBlock on Verisoning menu
0272: * and if it goes through the all test. My WindowMAnager is confused. I have to restart X-server :-(
0273: */
0274: //JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
0275: // JemmyProperties.setCurrentDispatchingModel(JemmyProperties.QUEUE_MODEL_MASK);
0276: log("setUp(DispatchModel)="
0277: + JemmyProperties.getCurrentDispatchingModel());
0278:
0279: /* Jemmy & Gnome workarround:
0280: * Usually happens on Linux and Gnome that just activated window doesn't have focus.
0281: * Calling this method :
0282: * ComponentOperator.setDefaultComponentVisualizer(new MouseVisualizer(MouseVisualizer.TOP, 0.5, 10, false);
0283: * or setting the following JellyProperty should help it:
0284: */
0285: //JellyProperties.setLinuxWindowActivation(true);
0286: if (testedJavaCVSFS != null)
0287: initHistory(testedJavaCVSFS);
0288:
0289: }
0290:
0291: /** method called after each testcase<br>
0292: * resets Jemmy WaitComponentTimeout
0293: */
0294: protected void tearDown() {
0295: JemmyProperties.setCurrentOutput(TestOut.getNullOutput());
0296: /* it is automaticaly flushed after returning into NbTestCase
0297: pstreams[0] = ps;
0298: pstreams[1] = psRef;
0299:
0300: for (int i=0 ; i < pstreams.length; i++) {
0301: pstreams[i].flush();
0302: pstreams[i].close ();
0303: }
0304: */
0305: // if ( ps != null ) ps.close();
0306: // if ( psRef != null) ps.close();
0307: }
0308:
0309: void fail(Exception e) {
0310: e.printStackTrace(getLog());
0311: if (capture) {
0312: try {
0313: PNGEncoder.captureScreen(getWorkDirPath()
0314: + "/screen.png");
0315: } catch (IOException ioe) {
0316: }
0317: }
0318: throw new AssertionFailedErrorException(e);
0319: }
0320:
0321: /** Method called in case of fail or error just after screen shot and XML dumps. <br>
0322: * Override this method when you need to be notified about test failures or errors
0323: * but avoid any exception to be throwed from this method.<br>
0324: * super.failNotify() does not need to be called because it is empty.
0325: * @param reason Throwable reason of current fail */
0326: protected void failNotify(Throwable reason) {
0327: System.out.println("jsi v failNotify()");
0328: sbt.printStatusTextHistory(ps);
0329: System.out.println(sbt.getStatusTextHistory().toString());
0330: if (his != null)
0331: his.print();
0332: }
0333:
0334: protected void dumpDiffGraphical(TopComponentOperator tco) {
0335: JEditorPaneOperator p1 = new JEditorPaneOperator(tco, 0);
0336: JEditorPaneOperator p2 = new JEditorPaneOperator(tco, 1);
0337: psRef.println("==== Text - Panel 1 ====");
0338: psRef.println(p1.getText());
0339: psRef.println("==== Text - Panel 2 ====");
0340: psRef.println(p2.getText());
0341: StyledDocument sd1 = (StyledDocument) p1.getDocument();
0342: StyledDocument sd2 = (StyledDocument) p2.getDocument();
0343: psRef.println("==== Colors - Panel 1 ====");
0344: dumpColors(sd1);
0345: psRef.println("==== Colors - Panel 2 ====");
0346: dumpColors(sd2);
0347: }
0348:
0349: protected static final Color annoWhite = new Color(254, 254, 254);
0350: protected static final Color annoGreen = new Color(180, 255, 180);
0351: protected static final Color annoBlue = new Color(160, 200, 255);
0352: protected static final Color annoRed = new Color(255, 160, 180);
0353:
0354: protected void dumpColors(StyledDocument sd) {
0355: int b = sd.getLength();// * 2;
0356: // psRef.println ("Len: " + b);
0357: for (int a = 0; a < b; a++) {
0358: Style st = sd.getLogicalStyle(a);
0359: if (st == null)
0360: continue;
0361: Color col = (Color) st
0362: .getAttribute(ColorConstants.Background);
0363: String str;
0364: if (annoWhite.equals(col))
0365: str = "White";
0366: else if (annoGreen.equals(col))
0367: str = "Green";
0368: else if (annoBlue.equals(col))
0369: str = "Blue";
0370: else if (annoRed.equals(col))
0371: str = "Red";
0372: else
0373: str = col.toString();
0374: psRef.println("Pos: " + a + " ---- " + str);
0375: a++;
0376: }
0377: }
0378:
0379: File getJavaCVSWork() throws IOException {
0380: return new File(getWorkDir().getParentFile(), WORKDIR);
0381: }
0382:
0383: File getTestFile() throws IOException {
0384: return (testFile == null) ? new File(System
0385: .getProperty(TESTFILEPROPERTY)) : testFile;
0386: }
0387:
0388: void setTestFile(File f) {
0389: testFile = f;
0390: System.setProperty(TESTFILEPROPERTY, f.getAbsolutePath());
0391: }
0392:
0393: void setClassVariable() {
0394: try {
0395: path = getJavaCVSWork().getAbsolutePath();
0396: } catch (IOException e) {
0397: e.printStackTrace();
0398: }
0399: filesystem = CVSlbl + path;
0400: }
0401:
0402: FileSystem getTestedJavaCVSFS(String filesystem) {
0403: // setClassVariable();
0404: Enumeration enFS = Repository.getDefault().getFileSystems();
0405: FileSystem tmpFS;
0406: while (enFS.hasMoreElements()) {
0407: tmpFS = (FileSystem) enFS.nextElement();
0408: if (tmpFS.getDisplayName().equals(filesystem)) {
0409: testedJavaCVSFS = tmpFS;
0410: return tmpFS;
0411: }
0412: }
0413: return null;
0414: }
0415:
0416: /** Inicializing of History object
0417: */
0418: void initHistory(FileSystem testedJavaCVSFS) {
0419: his = new util.History(testedJavaCVSFS, getLog());
0420: his.setBreakpoint(null);
0421: his.switchToJCVS();
0422: }
0423:
0424: /** invokes Connection Manager window from Versioning menu, adds new record and performs login
0425: * @throws Exception any unexpected exception thrown during test
0426: * @see #testMount next: testMount
0427: */
0428: public void testConnectionManager() {
0429: this .clearTestStatus();
0430: this .startTest();
0431: /* Please, don't change the following line !!!
0432: * necessary for treating result of the test
0433: */
0434: log("witchBRANCH",
0435: "This test suit was checkouted as the *release34*");
0436: try {
0437: log("Trying to push Main Menu:\n"
0438: + VERSIONINGMENU
0439: + "|"
0440: + Bundle
0441: .getStringTrimmed(
0442: "org.netbeans.modules.cvsclient.login.Bundle",
0443: "LoginManagerAction.dialogTitle")
0444: + "\n");
0445: new JCVSConnectionManagerAction().perform();
0446: log("Trying to invoke CVS Connection Manager dialog\n");
0447: CVSConnectionDialog conn = new CVSConnectionDialog();
0448:
0449: conn.activate();
0450: log("Trying to find and click 'Add' button to open Login Manager Dialog\n");
0451: CVSConnectionDialog.AddNewRootDialog add = conn.add();
0452: log("Trying to fill-in the dialog:\n" + SERVERTYPE + ","
0453: + SERVER + "," + USER + "," + PORT + ","
0454: + REPOSITORY + "\n");
0455: add.setAddNewRootOptions(SERVERTYPE, SERVER, USER, PORT,
0456: REPOSITORY);
0457: add.compareAddNewRootOptions(SERVERTYPE, SERVER, USER,
0458: PORT, REPOSITORY);
0459: add.verify();
0460: log("Trying to find and click 'OK' button\n");
0461: add.ok();
0462: CVSConnectionDialog.LoginToPserverDialog login = new CVSConnectionDialog.LoginToPserverDialog();
0463: log("Trying to write PASSWD in to the textfield: "
0464: + PASSWORD + "\n");
0465: login.setJPasswordField(PASSWORD);
0466: login.verify();
0467: log("Trying to find and click 'Login' button\n");
0468: login.login();
0469: int i = 0;
0470: while ((i++ < 30) && (login.isVisible())) {
0471: Thread.sleep(1000);
0472: }
0473: log("Trying to verify the login dialog\n");
0474: conn.verify();
0475: endTest();
0476: log("Trying to find 'Close' button\n");
0477: conn.close();
0478: } catch (Exception e) {
0479: fail(e);
0480: }
0481: }
0482:
0483: /** invokes CVS Wizard from Versioning menu, sets workdir, connection settings and performs initial checkout of module
0484: * @throws Exception any unexpected exception thrown during test
0485: * @see #testConnectionManager depends on: testConnectionManager
0486: * @see #testHistory <br>next: testHistory
0487: */
0488: public void testMount() {
0489: startTest();
0490: try {
0491: log("JavaCVSWork dir is:\n" + getJavaCVSWork() + "\n");
0492: File f = getJavaCVSWork();
0493: assertTrue(f.mkdirs());
0494:
0495: // log("Nasty workaround for bug #31026");
0496: log("Trying to push MainMenu:\n" + VERSIONINGMENU + "|"
0497: + MOUNTVCS + "|" + CVS + "\n");
0498: new JCVSMountAction().perform();
0499:
0500: /* //---Hacking bug #31026---
0501: //Checking if it was fixed or not
0502: new Action ("Versioning|Mount Version Control", null).performMenu (); //necessery for converting JmenuItem to Jmenu
0503: JMenuBarOperator jmbo = MainWindowOperator.getDefault().menuBar();
0504: javax.swing.JMenu jm = ((javax.swing.JMenuBar)jmbo.getSource()).getMenu(6); //Should be Versioning
0505: log("MainMenu je ... |"+ jm.getText()+"|");
0506:
0507: JMenuOperator jmo = new JMenuOperator(jm);
0508: log("jmo ma MenuItem? "+ jmo.getItemCount());
0509:
0510: int ii = 0;
0511: for(int i = 0; i < jmo.getItemCount(); i++) {
0512: if(((javax.swing.JMenu)jmo.getSource()).getItem(i) != null) {
0513: log( i + " |"+ ((javax.swing.JMenu)jmo.getSource()).getItem(i).getText() +"|");
0514: if ( ((javax.swing.JMenu)jmo.getSource()).getItem(i).getText().equals("Mount Version Control") ) ii = i;
0515: }
0516: }
0517:
0518: jmo = new JMenuOperator((javax.swing.JMenu) jmo.getItem(ii));
0519: log("Menu je ("+ii+") ... |"+ jmo.getText()+"|");
0520: log("jmo ma Item? "+ jmo.getItemCount());
0521: for(int i = 0 ; i < jmo.getItemCount(); i++) {
0522: log(" ... " + i + "|" + jmo.getItem(i).getText());
0523: }
0524: //End of check
0525: */
0526:
0527: /* log("Trying to push MainMenu:\n"+VERSIONINGMENU+"|"+MOUNTVCS+"\n");
0528: final String VERSIONING_MENU1 = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "Menu/Versioning");
0529: final String MOUNT_VERSIONING_CONTROL1 = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.actions.Bundle", "CTL_MountActionName");
0530: final String CVS_TYPE1 = Bundle.getStringTrimmed("org.netbeans.modules.vcscore.wizard.mountcvs.Bundle", "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
0531:
0532: new ActionNoBlock(VERSIONING_MENU1+"|"+MOUNT_VERSIONING_CONTROL1, null).perform();
0533: new ActionNoBlock("Tools", null).perform();
0534:
0535: org.netbeans.jemmy.Timeout tm = new org.netbeans.jemmy.Timeout("tmpTM", 10000);
0536: tm.sleep();
0537:
0538: new JCVSMountAction().perform();
0539: //---end of Hack---
0540: */
0541:
0542: NewWizardCVSDialog2 wizardPage1 = new NewWizardCVSDialog2();
0543: log("Trying to fill-in the first Panel of Wizard\n");
0544: wizardPage1.setWorkingDirectoryTxt(f.getAbsolutePath());
0545: wizardPage1.verify();
0546: wizardPage1.next();
0547: log("Trying to fill-in the second Panel of Wizard\n");
0548: NewWizardCVSDialog4 wizardPage2 = new NewWizardCVSDialog4();
0549: wizardPage2.setServerName(SERVER);
0550: wizardPage2.setUserName(USER);
0551: wizardPage2.setRepository(REPOSITORY);
0552: wizardPage2.verify();
0553: wizardPage2.next();
0554: log("Trying to fill-in the third Panel of Wizard\n");
0555: NewWizardCVSDialog5 wizardPage3 = new NewWizardCVSDialog5();
0556: wizardPage3.verify();
0557: wizardPage3.next();
0558: log("Trying to fill-in the fourth Panel of Wizard\n");
0559: NewWizardCVSDialog6 wizardPage4 = new NewWizardCVSDialog6(
0560: SERVER);
0561: wizardPage4.verify();
0562: wizardPage4.next();
0563: log("Trying to fill-in the fifth Panel of Wizard\n");
0564: NewWizardCVSDialog6a wizardPage5 = new NewWizardCVSDialog6a();
0565: log("Checking up Initial checkout!!!\n");
0566: wizardPage5
0567: .checkCheckOutACopyOfTheRepositoryFilesToYourWorkingDirectory(true);
0568: wizardPage5.verify();
0569: wizardPage5.finish();
0570:
0571: log("now the Checkout dilaog should comes up...\n");
0572: CheckoutDialog checkout = new CheckoutDialog();
0573:
0574: log("DEADLOCK when invoking 'Select Module' dialog is fixed now,\n"
0575: + "see issue #29464\nhttp://www.netbeans.org/issues/show_bug.cgi?id=29464 ,\n"
0576: + "please if during automat test DEADLOCK occures again, please REOPEN this bug!");
0577:
0578: log("Trying to open ModuleSelector dialog\n");
0579: CheckoutDialog.ModuleChooserDialog chooser = checkout
0580: .selectModule();
0581: log("Trying to find desired module: " + MODULE);
0582: int i = chooser.tabModulesTable().findCellRow(MODULE,
0583: new Operator.DefaultStringComparator(true, true));
0584: log("Desired module on line " + i
0585: + " has been found...selecting it\n");
0586: chooser.tabModulesTable().setRowSelectionInterval(i, i);
0587: chooser.verify();
0588: chooser.ok();
0589:
0590: // instead of it is used typing module into a text field
0591: /*
0592: checkout.txtCheckout().clearText();
0593: checkout.txtCheckout().typeText(MODULE);
0594: */
0595:
0596: checkout.verify();
0597:
0598: log("The outpuWindow should open now...\n");
0599:
0600: /* This piece of code is a workaround for problems with losted HierarchyEvent
0601: * There is an jemmy's issue http://www.netbeans.org/issues/show_bug.cgi?id=32466
0602: * but later appeared as a JDK bug: http://developer.java.sun.com/developer/bugParade/bugs/4924516.html
0603: */
0604: TabbedOutputOfVCSCommandsFrame out;
0605: try {
0606: EventTool.removeListeners();
0607: log("Trying to find and click 'Run command' button\n");
0608: checkout.runCommand();
0609: out = new TabbedOutputOfVCSCommandsFrame();
0610: } finally {
0611: EventTool.addListeners();
0612: }
0613: // end of workaround issue #32466
0614:
0615: endTest();
0616: setClassVariable();
0617: initHistory(getTestedJavaCVSFS(filesystem)); // just only for this TC. For the rest it is initialized in setUp() method
0618:
0619: out.verify();
0620: // endTest();
0621:
0622: log("Trying to find 'Close' button");
0623: out.close();
0624: log("Closed...\n");
0625: } catch (Exception e) {
0626: fail(e);
0627: }
0628: }
0629:
0630: /** looks for CVS command checkout history record under Explorer's Runtime tab, opens record and tests if "Finished" info is present
0631: * @throws Exception any unexpected exception thrown during test
0632: * @see #testMount depends on: testMount
0633: * @see #testCreateFile <br>next: testCreateFile
0634: */
0635: public void testHistory() {
0636: startTest();
0637: String path;
0638: String filesystem;
0639: CVS = Bundle.getStringTrimmed(
0640: "org.netbeans.modules.javacvs.Bundle",
0641: "JavaCvsFileSystem.validFilesystemLabel");
0642: String cmdStatus = Bundle.getStringTrimmed(
0643: "org.netbeans.modules.cvsclient.commands.Bundle",
0644: "CTL_Status_Done");
0645: boolean isCommandSuccessed;
0646: String status;
0647: try {
0648: path = getJavaCVSWork().getAbsolutePath();
0649: filesystem = CVS + path;
0650: /*Ask Milos How it's construct the command string which is in RunTime TAB
0651: * # RuntimeCommandNode:
0652: * # {0} .. Command's display name
0653: *The ResourceBundle is: org.netbeans.modules.vcscore.runtime.Bundle
0654: *The key is: RuntimeCommandNode.Description=VCS Command ''{0}''
0655: *on the line no: 70
0656: *
0657: *Property-Command name: Checkout
0658: *The ResourceBundle is: org.netbeans.modules.javacvs.commands.Bundle
0659: *The key is: CvsCheckout.name=Checkout
0660: *on the line no: 50
0661: */
0662: String command = "checkout " + MODULE;
0663:
0664: log("Trying to switch to RunTime TAB via API\n");
0665: APICommandsHistory history = new APICommandsHistory(api);
0666:
0667: log("Creating RunTime TAB Jemmy handler\n");
0668: CommandsHistory commandsHistory = new CommandsHistory();
0669:
0670: log("Verifying if command succeded...");
0671: isCommandSuccessed = history.isCommandSuccessed(filesystem,
0672: command, cmdStatus);
0673:
0674: log("Checkin' if command:\n |" + command
0675: + "|\non this filesystem:\n " + filesystem
0676: + "\nsuccessed: " + isCommandSuccessed + "\n");
0677: Thread.sleep(500L);
0678: assertTrue(
0679: "\nError: cvs command:\n |"
0680: + command
0681: + "|\nnode hasn't been found in RunTime TAB under the specified FS:\n "
0682: + filesystem + "|\n", isCommandSuccessed);
0683:
0684: log("Comparin' command status:\n |" + command + "|\n |"
0685: + cmdStatus + "|\non this filesystem:\n "
0686: + filesystem + "\n");
0687: Thread.sleep(500L);
0688: assertTrue("\nError: Wrong status of\n|" + command
0689: + "|\ncommand.", commandsHistory.compareStatus(
0690: cmdStatus, filesystem, command));
0691:
0692: log("Comparin' command name:\n |" + command
0693: + "|\non this filesystem:\n " + filesystem + "\n");
0694: Thread.sleep(500L);
0695: assertTrue("\nError: command name of\n|" + command
0696: + "|\ncommand.",
0697: commandsHistory.compareCommandName("Checkout",
0698: filesystem, command));
0699:
0700: /* This piece of code is a workaround for problems with losted HierarchyEvent
0701: * There is an jemmy's issue http://www.netbeans.org/issues/show_bug.cgi?id=32466
0702: * but later appeared as a JDK bug: http://developer.java.sun.com/developer/bugParade/bugs/4924516.html
0703: */
0704: TabbedOutputOfVCSCommandsFrame out;
0705: try {
0706: EventTool.removeListeners();
0707: log("Trying to open output of command...");
0708: out = commandsHistory.viewOutput(filesystem, command);
0709: } finally {
0710: EventTool.addListeners();
0711: }
0712: // end of workaround issue #32466
0713:
0714: log("succeeded, OPENED :)\n");
0715:
0716: status = Bundle.getString(
0717: "org.netbeans.modules.vcscore.commands.Bundle",
0718: "CommandExitStatus.finished");
0719: log("Comparin' statuses in the textfiled:\n |" + status
0720: + "|\n");
0721: Thread.sleep(500L);
0722: assertTrue(
0723: "\nError: command status is different from expected value:\n "
0724: + status + "|\n", out
0725: .compareStatusTextFld(status));
0726: out.verify();
0727:
0728: log("Trying to find 'Close' button\n");
0729: out.close();
0730: endTest();
0731: } catch (Exception e) {
0732: fail(e);
0733: }
0734: }
0735:
0736: String getTestFileObjectName() throws IOException {
0737: final String file = getTestFile().getName();
0738: return file.substring(0, file.lastIndexOf("."));
0739: }
0740:
0741: String getTestDirNodePath() throws IOException {
0742: return "CVS " + getJavaCVSWork().getAbsolutePath() + "|"
0743: + MODULE + "|"
0744: + getTestFile().getParentFile().getName();
0745: }
0746:
0747: String getTestDirObjectName() throws IOException {
0748: return getTestFile().getParentFile().getName();
0749: }
0750:
0751: /** creates new unique testdirectory under workdir, creates new testfile indside and verifies that both are present under Explorer's Filesystems tab with attribute [Local]
0752: * @throws Exception any unexpected exception thrown during test
0753: * @see #testHistory depends on: testHistory
0754: * @see #testAdd <br>next: testAdd
0755: */
0756: public void testCreateFile() {
0757: clearTestStatus();
0758: startTest();
0759: try {
0760: // MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
0761:
0762: log("Trying to find(create) a unique dir/file on a disk: \n"
0763: + TESTDIR
0764: + ", "
0765: + getJavaCVSWork()
0766: + ", "
0767: + MODULE
0768: + "\n");
0769: File f = File.createTempFile(TESTDIR, "", new File(
0770: getJavaCVSWork(), MODULE));
0771: assertTrue(f.delete());
0772:
0773: repositoryprefix = "/" + MODULE + "/" + f.getName();
0774: log("Trying to make directory: \n" + f.toString() + "\n");
0775: assertTrue(f.mkdir());
0776:
0777: log("Trying to create testing file: " + f + " ," + TESTFILE
0778: + ".java\n");
0779: setTestFile(new File(f, TESTFILE + ".java"));
0780: FileOutputStream out = new FileOutputStream(getTestFile());
0781: out.write(("class " + TESTFILE + " {}\n").getBytes());
0782:
0783: log("Trying to close the FileOutputStream\n");
0784: out.close();
0785:
0786: log("Trying to open new Explorer and imediately locate and switch to FS TAB...\n");
0787: Node rootNode = ExplorerOperator.invoke().repositoryTab()
0788: .getRootNode();//selectPageFilesystems();
0789:
0790: log("Creating a node on this filesystem:\n" + "CVS "
0791: + getJavaCVSWork().getAbsolutePath() + "\n");
0792: Node node = new Node(rootNode, "CVS "
0793: + getJavaCVSWork().getAbsolutePath());
0794: new JCVSRefreshAction().perform(node);
0795:
0796: log("Creating a node on this filesystem:\n" + "CVS "
0797: + getJavaCVSWork().getAbsolutePath() + "|" + MODULE
0798: + "\n");
0799: node = new Node(rootNode, "CVS "
0800: + getJavaCVSWork().getAbsolutePath() + "|" + MODULE);
0801: log("The node is:\n " + node.getParentPath() + "\n "
0802: + node.getPath() + "\n " + node.getText() + "\n "
0803: + node.toString() + "\n");
0804: log("Trying to go to PopupMenu:\n"
0805: + "CVS|Refresh\non this filesystem:\n "
0806: + node.getPath() + "\n");
0807: /*
0808: Operator.DefaultStringComparator comparator = new Operator.DefaultStringComparator(true, true);
0809: JMenuBarOperator
0810: // MainWindowOperator.getDefault().menuBar ().setDef
0811: // Operator.setDefaultStringComparator(comparator);
0812: Action ac = new Action(VERSIONINGMENU+"|"+CVS+"|Refresh", "CVS|Refresh");
0813: ac.setComparator(comparator);
0814: ac.performMenu(node);
0815: Operator.setDefaultStringComparator(oldComparator);
0816: */
0817:
0818: /* Operator.DefaultStringComparator comparator = new
0819: Operator.DefaultStringComparator(true, true);
0820: Action ac = new Action("Versioning|CVS|Refresh", null);
0821: ac.setComparator(comparator);
0822: ac.performMenu(node);
0823: */
0824: sbt.start();
0825: System.out.println("===BACHA!!! REFRESHIM ===");
0826: new JCVSRefreshAction().perform(node);
0827: sbt.waitText("CVS Client Running Command: Refresh", true);
0828: sbt.waitText("Finished: Refresh", true);
0829:
0830: // exp.tree().callPopupOnPath("CVS|Refresh", "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE);
0831: // exp.pushPopupMenu("CVS|Refresh", "CVS "+getJavaCVSWork().getAbsolutePath()+"|"+MODULE);
0832:
0833: log("Trying to select a node:\n " + rootNode.getPath()
0834: + "\n " + getTestDirNodePath() + " [Local]|"
0835: + getTestFileObjectName() + " [Local]\n");
0836: node = new Node(rootNode, getTestDirNodePath()
0837: + " [Local]|" + getTestFileObjectName()
0838: + " [Local]");
0839: node.select();
0840:
0841: // exp.selectNode(getTestDirNodePath()+" [Local]|"+getTestFileObjectName()+" [Local]");
0842: endTest();
0843: } catch (Exception e) {
0844: fail(e);
0845: }
0846: }
0847:
0848: /** invokes Add dialog from testdir's popup menu, runs add command recursively and verifies that testfile has now attributes [LAdded; New] under Explorer
0849: * @throws Exception any unexpected exception thrown during test
0850: * @see #testCreateFile depends on: testCreateFile
0851: * @see #testCommit <br>next: testCommit
0852: */
0853: public void testAdd() {
0854: startTest();
0855: try {
0856: // Explorer exp=new Explorer();
0857: log("Explorer should be opened..\n switching to FS TAB\n");
0858: // exp.switchToFilesystemsTab();
0859: Node node = new Node(ExplorerOperator.invoke()
0860: .repositoryTab().getRootNode(),
0861: getTestDirNodePath() + " [Local]");
0862:
0863: log("Trying to push popup menu 'CVS|Add...' on the node: "
0864: + getTestDirNodePath() + " [Local]\n");
0865: new JCVSAddAction().perform(node);
0866:
0867: log("Trying to open Add dialog\n");
0868: AddDialog add = new AddDialog();
0869:
0870: log("Checking up checkBox: 'Recursively'\n");
0871: add.check(add.cbRecursively(), true);
0872:
0873: log("Verifiing the dialog\n");
0874: add.verify();
0875:
0876: log("Trying to push the 'Run Command=OK' buttonn\n");
0877: add.runCommand();
0878:
0879: OutputOfVCSCommandsFrame out = new OutputOfVCSCommandsFrame();
0880: log("Verifying the OutputOfCommand dialog\n");
0881: out.verify();
0882:
0883: log("Trying to push the 'Close' button\n");
0884: out.close();
0885:
0886: log("TCs which are founding nodes using fileStatuses will probably fails\n"
0887: + "BECAUSE OF P1 #25987 BUG IN OPENIDE, see http://www.netbeans.org/issues/show_bug.cgi?id=25987");
0888: log("Trying to select a file node:\n "
0889: + getTestDirNodePath() + "|"
0890: + getTestFileObjectName() + " [LAdded; New]");
0891: Thread.sleep(1000L); //Rather wait sometime to give ide a possibility to refresh its nodes...
0892: new Node((new RepositoryTabOperator()).getRootNode(),
0893: getTestDirNodePath() + "|"
0894: + getTestFileObjectName()
0895: + " [LAdded; New]").select();
0896: // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+" [LAdded; New]");
0897: log("Selected... :-)\n");
0898: endTest();
0899: } catch (Exception e) {
0900: fail(e);
0901: }
0902: }
0903:
0904: /** 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
0905: * @throws Exception any unexpected exception thrown during test
0906: * @see #testAdd depends on: testAdd
0907: * @see #testDiff <br>next: testDiff
0908: */
0909: public void testCommit() {
0910: startTest();
0911: try {
0912: // Explorer exp=new Explorer();
0913: log("Trying to switch to FS TAB\n");
0914: Node node = new Node(ExplorerOperator.invoke()
0915: .repositoryTab().getRootNode(),
0916: getTestDirNodePath() + "|"
0917: + getTestFileObjectName()
0918: + " [LAdded; New]");
0919: // exp.switchToFilesystemsTab();
0920:
0921: log("Trying to push popup menu 'CVS|Commit...' on the node: "
0922: + getTestDirNodePath()
0923: + "|"
0924: + getTestFileObjectName() + " [LAdded; New]\n");
0925: new JCVSCommitAction().perform(node);
0926:
0927: CommitDialog commit = new CommitDialog();
0928: log("verifiing Commit dialog\n");
0929: commit.verify();
0930:
0931: log("Trying to push 'Run Command' button\n");
0932: commit.runCommand();
0933:
0934: OutputOfVCSCommandsFrame out = new OutputOfVCSCommandsFrame();
0935: log("verifiing the OutputOfCVSCommand dialog\n");
0936: out.verify();
0937:
0938: log("Trying to push 'Close' button\n");
0939: out.close();
0940:
0941: log("Trying to select a node:\n" + getTestDirNodePath()
0942: + "|" + getTestFileObjectName()
0943: + " [Up-to-date; 1.1]");
0944: new Node((new RepositoryTabOperator()).getRootNode(),
0945: getTestDirNodePath() + "|"
0946: + getTestFileObjectName()
0947: + " [Up-to-date; 1.1]").select();
0948: // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]");
0949: log("Selected... :-)\n");
0950: endTest();
0951: } catch (Exception e) {
0952: fail(e);
0953: }
0954: }
0955:
0956: /** 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
0957: * @throws Exception any unexpected exception thrown during test
0958: * @see #testCommit depends on: testCommit
0959: * @see #testVCSGroups <br>next: testVCSGroups
0960: */
0961: public void testDiff() {
0962: startTest();
0963: String path;
0964: CVS = Bundle.getStringTrimmed(
0965: "org.netbeans.modules.javacvs.Bundle",
0966: "JavaCvsFileSystem.validFilesystemLabel");
0967: String filesystem;
0968: try {
0969: path = getJavaCVSWork().getAbsolutePath();
0970: filesystem = CVS + path;
0971: // Explorer exp=new Explorer();
0972: log("Trying to switch to FS TAB\n");
0973: Node rootNode = ExplorerOperator.invoke().repositoryTab()
0974: .getRootNode();
0975: Node node = new Node(rootNode, getTestDirNodePath() + "|"
0976: + getTestFileObjectName() + " [Up-to-date; 1.1]");
0977: // exp.switchToFilesystemsTab();
0978: log("Trying to select a node:\n" + getTestDirNodePath()
0979: + "|" + getTestFileObjectName()
0980: + " [Up-to-date; 1.1]\n");
0981: // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.1]");
0982: node.select();
0983:
0984: log("Openning an FileOutputStream using this file:\n"
0985: + getTestFile() + "\n");
0986: FileOutputStream file = new FileOutputStream(getTestFile());
0987: log("Writing a text into it.\n");
0988: file.write(("//comment\nclass " + TESTFILE + " {}\n")
0989: .getBytes());
0990: file.close();
0991:
0992: log("Trying to open PopupMenu:\n'CVS|Refresh' on a node:\n"
0993: + getTestDirNodePath() + "\n");
0994: node = new Node(rootNode, getTestDirNodePath());
0995: // exp.pushPopupMenu("CVS|Refresh", getTestDirNodePath());
0996: new JCVSRefreshAction().perform(node);
0997:
0998: MainWindowOperator.getDefault().waitStatusText(
0999: "Finished: Refresh");
1000:
1001: // Node rootNode1 = ExplorerOperator.invoke().runtimeTab().getRootNode();
1002: // rootNode1.select();
1003: /* The folowing block of code is there because I need wait for a node ...
1004: * It needs establish after refresh. And it's good for testing stability
1005: */
1006: rootNode = ExplorerOperator.invoke().repositoryTab()
1007: .getRootNode();
1008: node = new Node(rootNode, getTestDirNodePath() + "|"
1009: + getTestFileObjectName());
1010: node.select();
1011:
1012: // log("Trying to open PopupMenu:\n'CVS|Diff...', "+ getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]\n");
1013: // node = new Node(rootNode, getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]");
1014: // node = new Node(node, " [LMod; 1.1]");
1015:
1016: // exp.pushPopupMenu("CVS|Diff...", getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]");
1017: log("node je...:\n" + node.getPath());
1018: node.select();
1019: new JCVSDiffAction().perform(node);
1020:
1021: log("Trying to open dialog for Diff command...\n");
1022: DiffDialog diff = new DiffDialog();
1023: diff.verify();
1024: log("Trying to click on 'Run Command' button...\n");
1025: diff.runCommand();
1026:
1027: log("TCs which are test 'Output Of VCS command [' dialogs will probably fails\n"
1028: + "BECAUSE OF P3 #26811 BUG IN CORE, see http://www.netbeans.org/issues/show_bug.cgi?id=26811");
1029: log("Opening Diff output window...\n");
1030:
1031: TopComponentOperator tco = new TopComponentOperator(
1032: new EditorWindowOperator(), "Diff testfile.java");
1033: dumpDiffGraphical(tco);
1034: compareReferenceFiles();
1035:
1036: tco.undockView();
1037: JCVSDiffOutputOperator out = new JCVSDiffOutputOperator(
1038: "Diff testfile.java", "1.1", "Working File");
1039: log("Verifiing if everything is allright on the diff output\n");
1040: out.verify();
1041:
1042: log("Trying to push 'Close' button\n");
1043: out.close();
1044: endTest();
1045: } catch (Exception e) {
1046: fail(e);
1047: }
1048: }
1049:
1050: void switchToTab(ExplorerOperator expO, String tab)
1051: throws Exception {
1052: expO.invoke().selectPage(tab);
1053: }
1054:
1055: /** 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
1056: * @throws Exception any unexpected exception thrown during test
1057: * @see #testDiff depends on: testDiff
1058: * @see #testVersioningExplorer <br>next: testVersioningExplorer
1059: */
1060: public void testVCSGroups() {
1061: clearTestStatus();
1062: startTest();
1063: CVS = Bundle
1064: .getStringTrimmed(
1065: "org.netbeans.modules.vcscore.wizard.mountcvs.Bundle",
1066: "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1067: String strCmdAction = Bundle.getStringTrimmed(
1068: "org.netbeans.modules.cvsclient.actions.Bundle",
1069: "LBL_JCommitAction")
1070: + Bundle.getStringTrimmed(
1071: "org.netbeans.modules.vcscore.actions.Bundle",
1072: "ClusteringAction.DialogDots");
1073: final String DEFAULTGROUP = Bundle.getStringTrimmed(
1074: "org.netbeans.modules.vcscore.grouping.Bundle",
1075: "LBL_DefaultGroupName");
1076: final String vcsgrpT = Bundle.getStringTrimmed(
1077: "org.netbeans.modules.vcscore.grouping.Bundle",
1078: "LBL_MODE.title");
1079: final String vcsgrpM = Bundle.getStringTrimmed(
1080: "org.netbeans.modules.vcscore.grouping.Bundle",
1081: "LBL_VcsGroupMenuAction");
1082: final String addTovcsGrp = Bundle.getStringTrimmed(
1083: "org.netbeans.modules.vcscore.actions.Bundle",
1084: "LBL_AddToGroupAction");
1085: final String verify = Bundle.getStringTrimmed(
1086: "org.netbeans.modules.vcscore.grouping.Bundle",
1087: "LBL_VerifyGroupAction");
1088: final String dialogTitle = Bundle.getStringTrimmed(
1089: "org.openide.explorer.Bundle",
1090: "MSG_ConfirmDeleteObjectTitle");
1091: try {
1092: log("Trying to get an instance of MainFrame\n");
1093: // MainFrame main=MainFrame.getMainFrame();
1094: MainWindowOperator main = MainWindowOperator.getDefault();
1095: ExplorerOperator exp = new ExplorerOperator();
1096: Node rootNode = exp.invoke().repositoryTab().getRootNode();
1097: JTreeOperator jtro = null;
1098:
1099: log("Trying to invoke PopupMenu:\n" + addTovcsGrp + "|"
1100: + DEFAULTGROUP + ", on\n" + getTestDirNodePath()
1101: + "|" + getTestFileObjectName() + " [LMod; 1.1]\n");
1102: // exp.pushPopupMenu(addTovcsGrp+"|"+DEFAULTGROUP, getTestDirNodePath()+"|"+getTestFileObjectName()+" [LMod; 1.1]");
1103: Node node = new Node(rootNode, getTestDirNodePath() + "|"
1104: + getTestFileObjectName() + " [LMod; 1.1]");
1105: node.performPopupAction(addTovcsGrp + "|" + DEFAULTGROUP);
1106:
1107: log("Trying to push MainMenu:\n" + VERSIONINGMENU + "|"
1108: + vcsgrpM + "\n");
1109:
1110: new VCSGroupsAction().perform();
1111: try { // try is here because VCS Groups frame can be already docked under Explorer
1112: log("Realy trying to open VCSGroup Frame\n");
1113: VCSGroupsFrameOperator groups = new VCSGroupsFrameOperator();
1114: // VCSGroupsFrame groups = new VCSGroupsFrame();
1115: log("Verifying the VCSGroup dialog...\n");
1116: groups.makeComponentVisible();
1117: groups.verify();
1118: Thread.sleep(500);
1119:
1120: log("Trying to invoke MainMenu:\n'Window|Dock View Into|Explorer|Center'\n");
1121: new DockingAction("Explorer|" + DockingAction.CENTER)
1122: .perform();
1123: // main.pushMenuNoExact("Window|Dock View Into|Explorer|Center");
1124: } catch (JemmyException ex) {
1125: log("Seems that VCSGroup's been already docked in Exp");
1126: }
1127:
1128: log("Trying to switch to VCS Groups TAB\n");
1129: //exp=new Explorer();
1130: //This probably isn't needed and the construction below seems good enought
1131: /* for(int i = 0; i < exp.tbpExplorerTabPane().getTabCount(); i ++){
1132: String sTitle = exp.tbpExplorerTabPane().getTitleAt(i);
1133: if(sTitle.indexOf(vcsgrpT) >= 0) {
1134: exp.selectPage(vcsgrpT);
1135: jtro = new JTreeOperator(JTreeOperator.waitJTree( (Container)
1136: exp.tbpExplorerTabPane().getComponent(i), null, false, false, 0));
1137: }
1138: }
1139: */
1140: exp.selectPage(vcsgrpT);
1141: jtro = new JTreeOperator(JTreeOperator.waitJTree(
1142: (Container) exp.tbpExplorerTabPane().getSource(),
1143: vcsgrpT, true, true, 0));
1144:
1145: log("Trying to invoke PopupMenu:\n'Verify', "
1146: + " on the\n" + DEFAULTGROUP + "\n");
1147: new VerifyGroupAction()
1148: .perform(new Node(jtro, DEFAULTGROUP));
1149:
1150: log("Trying to open GroupVerification Dialog....\n");
1151: GroupVerificationOperator out = new GroupVerificationOperator();
1152:
1153: log("Trying to verify the Group dialog...\n");
1154: out.verify(false, false, false, false);
1155: log("Trying to click on 'Close' button\n");
1156: out.close();
1157:
1158: log("Invoking PopupMenu:\n'" + CVS + "|" + strCmdAction
1159: + "', on " + DEFAULTGROUP + "\n");
1160: new JCVSCommitAction()
1161: .perform(new Node(jtro, DEFAULTGROUP));
1162: // exp.pushPopupMenu("CVS|Commit...", DEFAULTGROUP);
1163:
1164: log("Commit dialog should appeare\n");
1165: // No jelly2 CommitDialogOperator
1166: CommitDialog commit = new CommitDialog();
1167:
1168: log("Verifying the Commit dialog...\n");
1169: commit.verify();
1170: log("Trying to click on 'Run Command' button\n");
1171: commit.runCommand();
1172:
1173: log("...an CommandOutputWindow should open NOW...\n");
1174: // No jelly2 CommanOutputWondowOperator
1175: OutputOfVCSCommandsFrame out2 = new OutputOfVCSCommandsFrame();
1176:
1177: log("Verifying the Output dialog....\n");
1178: out2.verify();
1179:
1180: log("Trying to click on 'Close' button\n");
1181: out2.close();
1182:
1183: log("Trying to invoke PopupMenu:\n'Delete', "
1184: + DEFAULTGROUP);
1185: strCmdAction = Bundle.getStringTrimmed(
1186: "org.openide.actions.Bundle", "Delete");
1187: new DeleteAction().perform(new Node(jtro, DEFAULTGROUP));
1188: // exp.pushPopupMenu("Delete", DEFAULTGROUP);
1189:
1190: log("Answering YES! to the YesNoDialog 'Confirm Object Deletion'...\n");
1191: new NbDialogOperator(dialogTitle).yes();
1192: // new JelloYesNoDialog("Confirm Object Deletion").yes();
1193:
1194: //exp=new Explorer();
1195: log("...sleeping 1s...\n");
1196: Thread.sleep(1000);
1197:
1198: log("Trying to switch to FS's TAB\n");
1199: rootNode = exp.invoke().repositoryTab().getRootNode();//selectPageFilesystems();
1200:
1201: log("Trying to select a node:\n" + getTestDirNodePath()
1202: + "|" + getTestFileObjectName()
1203: + " [Up-to-date; 1.2]\n");
1204: // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+" [Up-to-date; 1.2]");
1205: node = new Node(rootNode, getTestDirNodePath() + "|"
1206: + getTestFileObjectName() + " [Up-to-date; 1.2]");
1207: node.select();
1208: endTest();
1209: } catch (Exception e) {
1210: fail(e);
1211: }
1212: }
1213:
1214: /** 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
1215: * @throws Exception any unexpected exception thrown during test
1216: * @see #testVCSGroups depends on: testVCSGroups
1217: * @see #testBranch <br>next: testBranch
1218: */
1219: public void testVersioningExplorer() {
1220: startTest();
1221: String versioning = Bundle.getStringTrimmed(
1222: "org.netbeans.modules.vcscore.versioning.impl.Bundle",
1223: "versioningSystemName");
1224: final String verExplorer = Bundle.getStringTrimmed(
1225: "org.netbeans.modules.vcscore.actions.Bundle",
1226: "LBL_VersioningExplorer");
1227: try {
1228: log("Trying to get MainFrame...\n");
1229: MainWindowOperator main = MainWindowOperator.getDefault();
1230: ExplorerOperator exp = new ExplorerOperator();
1231: Node rootNode = exp.invoke().repositoryTab().getRootNode();
1232: JTreeOperator jtro = null;
1233:
1234: log("Trying to switch to FS's TAB\n");
1235: exp.selectPageFilesystems();
1236:
1237: log("Invoking popup menu 'Versioning Explorer' on a node:\n"
1238: + getTestDirNodePath() + "\n");
1239: new VersioningExplorerAction().perform(new Node(rootNode,
1240: getTestDirNodePath()));
1241:
1242: try { // try is here because Versioning Explorer can be already docked under Explorer
1243: new VersioningFrameOperator().verify();
1244: log("Trying to dock the Explorer window into Explorer... pushing a MainMenu:\n'Window|Dock View Into|Explorer|Center'\n");
1245: new DockingAction("Explorer|" + DockingAction.CENTER)
1246: .perform();
1247: } catch (JemmyException ex) {
1248: log("Seems that Versioning Expl.'s been already docked in Exp");
1249: }
1250:
1251: Thread.sleep(1000);
1252: log("Trying to switch to Versioning TAB\n");
1253: switchToTab(exp, versioning);
1254: jtro = new JTreeOperator(JTreeOperator.waitJTree(
1255: (Container) exp.tbpExplorerTabPane().getSource(),
1256: versioning, true, true, 0));
1257:
1258: log("Trying to select a node:\n" + getTestDirNodePath()
1259: + "\n");
1260: Node node = new Node(jtro, getTestDirNodePath());
1261: node.select();
1262: // exp.selectNode(getTestDirNodePath());
1263:
1264: log("Trying to select a node:\n" + getTestDirNodePath()
1265: + "|" + getTestFileObjectName()
1266: + ".java [Up-to-date; 1.2]\n");
1267: // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]");
1268: node = new Node(node, getTestFileObjectName()
1269: + ".java [Up-to-date; 1.2]");
1270: node.select();
1271: node.expand();
1272:
1273: /* Checking if there isn't unluckyly "Please wait..." node
1274: */
1275: boolean isPlease = true;
1276: TreePath tp = jtro.findPath(getTestDirNodePath() + "|"
1277: + getTestFileObjectName() + ".java", "|");
1278: jtro.expandPath(tp);
1279: log("This is TreePath on VE node:\n" + tp + "\n");
1280: while (isPlease) {
1281: for (int i = 0; i < jtro.getChildCount(tp); i++) {
1282: String please = jtro.getChildPath(tp, i)
1283: .getLastPathComponent().toString().trim();
1284: log("This is String node 'Please wait':\n" + please);
1285: if (please.equals("Please wait...")
1286: || please.indexOf("Please wait...") > -1) {
1287: log("There is still 'Please wait...' node.\nWe're waiting another second for refreshing nodes");
1288: Thread.sleep(1000);
1289: } else {
1290: isPlease = false;
1291: }
1292: }
1293: }
1294:
1295: log("Trying to select a node:\n" + getTestDirNodePath()
1296: + "|" + getTestFileObjectName()
1297: + ".java [Up-to-date; 1.2]|1.1 no message \n");
1298: // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]|1.1 no message ");
1299: Node tmpNode = node;
1300: node = new Node(node, "1.1 no message ");
1301: node.select();
1302: // node.expand();
1303:
1304: log("Trying to select a node:\n" + getTestDirNodePath()
1305: + "|" + getTestFileObjectName()
1306: + ".java [Up-to-date; 1.2]|1.2 <Default Group> \n");
1307: // exp.selectNode(getTestDirNodePath()+"|"+getTestFileObjectName()+".java [Up-to-date; 1.2]|1.2 <Default Group> ");
1308: node = new Node(tmpNode, "1.2 <Default Group> ");
1309: node.select();
1310: endTest();
1311:
1312: log("Switching into FS TAB\n");
1313: // exp.switchToFilesystemsTab();
1314: exp.selectPageFilesystems();
1315: } catch (Exception e) {
1316: fail(e);
1317: }
1318: }
1319:
1320: /** 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
1321: * @throws Exception any unexpected exception thrown during test
1322: * @see #testVersioningExplorer depends on: testVersioningExplorer
1323: * @see #testUpdateBranch <br>next: testUpdateBranch
1324: */
1325: public void testBranch() {
1326: startTest();
1327: strCmdAction = Bundle.getStringTrimmed(
1328: "org.netbeans.modules.cvsclient.actions.Bundle",
1329: "LBL_JTagAction")
1330: + "...";
1331: String versioning = Bundle.getStringTrimmed(
1332: "org.netbeans.modules.vcscore.versioning.impl.Bundle",
1333: "versioningSystemName");
1334: String refrRev = Bundle.getStringTrimmed(
1335: "org.netbeans.modules.vcscore.versioning.Bundle",
1336: "RefreshRevisionsAction_Name");
1337: CVS = Bundle
1338: .getStringTrimmed(
1339: "org.netbeans.modules.vcscore.wizard.mountcvs.Bundle",
1340: "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1341: try {
1342:
1343: // MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
1344: // MainWindowOperator main = MainWindowOperator.getDefault();
1345: ExplorerOperator exp = new ExplorerOperator();
1346: Node rootNode = exp.invoke().repositoryTab().getRootNode();
1347: JTreeOperator jtro = null;
1348: log("Trying to switch to FS TAB in Explorer\n");
1349: exp.selectPageFilesystems();
1350:
1351: log("Trying to push PopupMe4nu:\n" + CVS + "|"
1352: + strCmdAction + "\non this node:\n"
1353: + getTestDirNodePath() + "|"
1354: + getTestFileObjectName() + " [Up-to-date; 1.2]\n");
1355: new JCVSTagAction(true).perform(new Node(rootNode,
1356: getTestDirNodePath() + "|"
1357: + getTestFileObjectName()
1358: + " [Up-to-date; 1.2]"));
1359:
1360: log("Trying to open TAG dialog\n");
1361: // No jelly2 TagDialogOperator
1362: TagDialog tag = new TagDialog();
1363:
1364: log("Writing text 'vetev2' into tag textfield...\n");
1365: tag.txtTag().setText("vetev2");
1366:
1367: log("Checking up check box for branch tag...\n");
1368: tag.check(tag.cbBranch(), true);
1369:
1370: /* Because of cvsrc file, there could be predefined various command switches
1371: * which we don't know. So we traying to find as much known substring as it is possible
1372: */
1373: log("Trying to find known tag switches: '-b vetev2'\n");
1374: assertTrue("Switches are different!", tag
1375: .compareSwitches("tag -"));
1376: assertTrue("Switches are different!", tag
1377: .compareSwitches(" -b vetev2"));
1378:
1379: log("Verification TAG dialog....\n");
1380: tag.verify();
1381:
1382: /* This component isn't used anymore now
1383: * Instead of it is used this one:
1384: * TabbedOutputOfVCSCommandsFrame
1385: */
1386: // OutputOfVCSCommandsFrame out=new OutputOfVCSCommandsFrame();
1387: /* This piece of code is a workaround for problems with losted HierarchyEvent
1388: * There is an jemmy's issue http://www.netbeans.org/issues/show_bug.cgi?id=32466
1389: * but later appeared as a JDK bug: http://developer.java.sun.com/developer/bugParade/bugs/4924516.html
1390: */
1391: TabbedOutputOfVCSCommandsFrame out;
1392: try {
1393: EventTool.removeListeners();
1394: log("Trying ot execute command => clickin' on OK button\n");
1395: tag.runCommand();
1396: log("The Output Of VCS Command window should be opened now...\n");
1397: out = new TabbedOutputOfVCSCommandsFrame();
1398: } finally {
1399: EventTool.addListeners();
1400: }
1401: // end of workaround issue #32466
1402:
1403: log("Trying to verify the dialog\n");
1404: //Nefunguje komponenta
1405: // pouzivej TabbedOutputOfVCSCommandsFrame out=new TabbedOutputOfVCSCommandsFrame();
1406: out.verify();
1407:
1408: log("Trying to close the dialog\n");
1409: out.close();
1410:
1411: //exp=new Explorer();
1412: log("Trying to switch to 'Versioning' TAB in the Explorer\n");
1413: switchToTab(exp, versioning);
1414:
1415: jtro = new JTreeOperator(JTreeOperator.waitJTree(
1416: (Container) exp.tbpExplorerTabPane().getSource(),
1417: versioning, true, true, 0));
1418:
1419: //Starting listening to MainWindow's status line
1420: sbt.start();
1421: log("Trying to push PopupMenu:\n"
1422: + "Refresh Revisions\non the node:\n"
1423: + getTestDirNodePath() + "|"
1424: + getTestFileObjectName()
1425: + ".java [Up-to-date; 1.2]\n");
1426:
1427: new RefreshRevisionsAction().perform(new Node(jtro,
1428: getTestDirNodePath() + "|"
1429: + getTestFileObjectName()
1430: + ".java [Up-to-date; 1.2]"));
1431:
1432: log("Trying to find this String 'Finished: Log' in the status line of the MainFrame...\n");
1433: // Will expaire after 60s and throw an Exception if no matching String will be found.
1434: sbt.contains("Finished: Log", true);
1435: sbt.stop();
1436:
1437: new EventTool().waitNoEvent(2000);
1438: log("Trying to select node in the Explorer:\n"
1439: + getTestDirNodePath()
1440: + "|"
1441: + getTestFileObjectName()
1442: + ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)\n");
1443: (new Node(
1444: jtro,
1445: getTestDirNodePath()
1446: + "|"
1447: + getTestFileObjectName()
1448: + ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)"))
1449: .select();
1450:
1451: endTest();
1452: log("Trying to switch to FS TAB\n");
1453: exp.selectPageFilesystems();
1454: } catch (Exception e) {
1455: fail(e);
1456: }
1457: }
1458:
1459: /** 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
1460: * @throws Exception any unexpected exception thrown during test
1461: * @see #testBranch depends on: testBranch
1462: * @see #testCommitToBranch <br>next: testCommitToBranch
1463: */
1464: public void testUpdateBranch() {
1465: startTest();
1466: strCmdAction = Bundle.getStringTrimmed(
1467: "org.netbeans.modules.cvsclient.actions.Bundle",
1468: "LBL_JUpdateAction")
1469: + "...";
1470: CVS = Bundle
1471: .getStringTrimmed(
1472: "org.netbeans.modules.vcscore.wizard.mountcvs.Bundle",
1473: "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1474: try {
1475: ExplorerOperator exp = new ExplorerOperator();
1476: Node rootNode = exp.invoke().repositoryTab().getRootNode();
1477: // JTreeOperator jtro = null;
1478:
1479: exp.selectPageFilesystems();
1480: new Action(null, CVS + "|" + strCmdAction)
1481: .perform(new Node(rootNode, getTestDirNodePath()
1482: + "|" + getTestFileObjectName()
1483: + " [Up-to-date; 1.2]"));
1484:
1485: // No jelly2 UpdateDialogOperator
1486: UpdateDialog update = new UpdateDialog();
1487: update.check(update.cbRevisionTag(), true);
1488: update.txtRevisionTag().setText("vetev2");
1489: update.check(update.cbRevisionTag(), false);
1490: update.check(update.cbRevisionTag(), true);
1491: /* Because of cvsrc file, there could be predefined various command switches
1492: * which we don't know. So we traying to find as much known substring as it is possible
1493: */
1494: assertTrue("Switches are different!", update
1495: .compareSwitches("update -"));
1496: assertTrue("Switches are different!", update
1497: .compareSwitches(" -r vetev2"));
1498:
1499: update.verify();
1500: update.runCommand();
1501: // No jelly2 OutputOfVCSCommandsFrameOperator
1502: OutputOfVCSCommandsFrame out = new OutputOfVCSCommandsFrame();
1503: out.verify();
1504: out.close();
1505: new Node(rootNode, getTestDirNodePath() + "|"
1506: + getTestFileObjectName()
1507: + " [Up-to-date; 1.2] (vetev2)").select();
1508: endTest();
1509: } catch (Exception e) {
1510: fail(e);
1511: }
1512: }
1513:
1514: /** 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
1515: * @throws Exception any unexpected exception thrown during test
1516: * @see #testUpdateBranch depends on: testUpdateBranch
1517: * @see #testMerge <br>next: testMerge
1518: */
1519: public void testCommitToBranch() {
1520: startTest();
1521: strCmdAction = Bundle.getStringTrimmed(
1522: "org.netbeans.modules.cvsclient.actions.Bundle",
1523: "LBL_JRefreshAction");
1524: String commitcmd = Bundle.getStringTrimmed(
1525: "org.netbeans.modules.cvsclient.actions.Bundle",
1526: "LBL_JCommitAction")
1527: + "...";
1528: String versioning = Bundle.getStringTrimmed(
1529: "org.netbeans.modules.vcscore.versioning.impl.Bundle",
1530: "versioningSystemName");
1531: String refrRev = Bundle.getStringTrimmed(
1532: "org.netbeans.modules.vcscore.versioning.Bundle",
1533: "RefreshRevisionsAction_Name");
1534: CVS = Bundle
1535: .getStringTrimmed(
1536: "org.netbeans.modules.vcscore.wizard.mountcvs.Bundle",
1537: "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1538: try {
1539: ExplorerOperator exp = new ExplorerOperator();
1540: Node rootNode = exp.invoke().repositoryTab().getRootNode();
1541: // MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
1542: Node node = null;
1543: JTreeOperator jtro = null;
1544:
1545: log("Trying to switch to FS Tab\n");
1546: exp.selectPageFilesystems();
1547:
1548: log("Trying to select this node:\n" + getTestDirNodePath()
1549: + "|" + getTestFileObjectName()
1550: + " [Up-to-date; 1.2] (vetev2)");
1551: new Node(rootNode, getTestDirNodePath() + "|"
1552: + getTestFileObjectName()
1553: + " [Up-to-date; 1.2] (vetev2)").select();
1554:
1555: FileOutputStream file = new FileOutputStream(getTestFile());
1556: file
1557: .write(("//comment\nclass " + TESTFILE + " {\n//branch vetev2\n}\n")
1558: .getBytes());
1559: file.close();
1560:
1561: log("Trying to push PopupMenu:\n" + CVS + "|"
1562: + strCmdAction + "\non the node:\n"
1563: + getTestDirNodePath() + "\n");
1564: new JCVSRefreshAction().perform(new Node(rootNode,
1565: getTestDirNodePath()));
1566:
1567: log("Trying to push PopupMenu:\n" + CVS + "|" + commitcmd
1568: + "\non the node:\n" + getTestDirNodePath() + "|"
1569: + getTestFileObjectName()
1570: + " [LMod; 1.2] (vetev2)\n");
1571: new JCVSCommitAction().perform(new Node(rootNode,
1572: getTestDirNodePath() + "|"
1573: + getTestFileObjectName()
1574: + " [LMod; 1.2] (vetev2)"));
1575:
1576: log("Opening the Commit dialog...\n");
1577: // No jelly2 CommitDialogOperator
1578: CommitDialog commit = new CommitDialog();
1579:
1580: log("Trying to verify the dialog...\b");
1581: commit.verify();
1582:
1583: log("Executing the command...\n");
1584: commit.runCommand();
1585:
1586: log("Opening the 'Output of VCS Commands [' dialog...\n");
1587: OutputOfVCSCommandsFrame out = new OutputOfVCSCommandsFrame();
1588:
1589: log("Verifying the dialog...\n");
1590: out.verify();
1591:
1592: log("Closing t dialog...\n");
1593: out.close();
1594:
1595: log("Trying to select a node:\n" + getTestDirNodePath()
1596: + "|" + getTestFileObjectName()
1597: + " [Up-to-date; 1.2.2.1] (vetev2)\n");
1598: new Node(rootNode, getTestDirNodePath() + "|"
1599: + getTestFileObjectName()
1600: + " [Up-to-date; 1.2.2.1] (vetev2)").select();
1601:
1602: log("Trying to switch to Verifying TAB\n");
1603: switchToTab(exp, versioning);
1604: jtro = new JTreeOperator(JTreeOperator.waitJTree(
1605: (Container) exp.tbpExplorerTabPane().getSource(),
1606: versioning, true, true, 0));
1607:
1608: log("Selecting a node:\n" + getTestDirNodePath());
1609: node = new Node(jtro, getTestDirNodePath());
1610: node.select();
1611:
1612: sbt.start();
1613: log("Trying to push PopupMenu:\n" + refrRev
1614: + "\non the node:\n" + getTestDirNodePath() + "|"
1615: + getTestFileObjectName()
1616: + ".java [Up-to-date; 1.2.2.1] (vetev2)+\n");
1617:
1618: node = new Node(node, getTestFileObjectName()
1619: + ".java [Up-to-date; 1.2.2.1] (vetev2)");
1620:
1621: new RefreshRevisionsAction().perform(node);
1622:
1623: log("Verifying status line in MainFrame...'Finished: Log'\n");
1624: sbt.waitText("Finished: Log");
1625: sbt.stop();
1626:
1627: /* Waiting for creating node after LOG command in VE */
1628: try {
1629: new Waiter(new Waitable() {
1630: public Object actionProduced(Object parent) {
1631: return new Node((Node) parent,
1632: "1.2|1.2.2 (vetev2)")
1633: .isChildPresent("1.2.2.1") ? Boolean.TRUE
1634: : null;
1635: }
1636:
1637: public String getDescription() {
1638: return ("Child '1.2.2 (vetev2)' present under parent '1.2 <Default Group> '");
1639: }
1640: }).waitAction(node);
1641: } catch (InterruptedException e) {
1642: throw new JemmyException("Interrupted.", e);
1643: }
1644:
1645: log("Selecting node:\n"
1646: + getTestDirNodePath()
1647: + "|"
1648: + getTestFileObjectName()
1649: + ".java [Up-to-date; 1.2.2.1] (vetev2)|1.2 <Default Group> |1.2.2 (vetev2)|1.2.2.1 no message \n");
1650:
1651: node = new Node(
1652: jtro,
1653: getTestDirNodePath()
1654: + "|"
1655: + getTestFileObjectName()
1656: + ".java [Up-to-date; 1.2.2.1] (vetev2)|1.2 <Default Group> |1.2.2 (vetev2)|1.2.2.1 no message ");
1657: log("Selected node should be:\n" + node.getPath());
1658:
1659: node.select();
1660: endTest();
1661:
1662: log("Trying to switch to FS TAB\n");
1663: exp.selectPageFilesystems();
1664: } catch (Exception e) {
1665: fail(e);
1666: }
1667: }
1668:
1669: /** 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
1670: * @throws Exception any unexpected exception thrown during test
1671: * @see #testCommitToBranch depends on: testCommitToBranch
1672: * @see #testStatus <br>next: testStatus
1673: */
1674: public void testMerge() {
1675: startTest();
1676: strCmdAction = Bundle.getStringTrimmed(
1677: "org.netbeans.modules.cvsclient.actions.Bundle",
1678: "LBL_JUpdateAction")
1679: + "...";
1680: String versioning = Bundle.getStringTrimmed(
1681: "org.netbeans.modules.vcscore.versioning.impl.Bundle",
1682: "versioningSystemName");
1683: String merge = Bundle.getStringTrimmed(
1684: "org.netbeans.modules.cvsclient.versioning.Bundle",
1685: "JavaCvsVersioningAction.merge");
1686: String commitCmd = Bundle.getStringTrimmed(
1687: "org.netbeans.modules.cvsclient.actions.Bundle",
1688: "LBL_JCommitAction")
1689: + "...";
1690: CVS = Bundle
1691: .getStringTrimmed(
1692: "org.netbeans.modules.vcscore.wizard.mountcvs.Bundle",
1693: "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1694: try {
1695: ExplorerOperator exp = new ExplorerOperator();
1696: Node rootNode = exp.invoke().repositoryTab().getRootNode();
1697: // MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
1698: JTreeOperator jtro = null;
1699:
1700: log("Trying to switch to FS Tab\n");
1701: exp.selectPageFilesystems();
1702:
1703: log("Trying to push PopupMenu:\n" + CVS + "|"
1704: + strCmdAction + "\non the node:\n"
1705: + getTestDirNodePath() + "|"
1706: + getTestFileObjectName()
1707: + " [Up-to-date; 1.2.2.1] (vetev2)\n");
1708: new JCVSUpdateAction().perform(new Node(rootNode,
1709: getTestDirNodePath() + "|"
1710: + getTestFileObjectName()
1711: + " [Up-to-date; 1.2.2.1] (vetev2)"));
1712:
1713: log("Opening Update dialog...\n");
1714: // No jelly2 UpdateDialogOperator
1715: UpdateDialog update = new UpdateDialog();
1716:
1717: log("Trying to 'reset sticky tag'...\n");
1718: update.check(update.cbResetSticky(), true);
1719:
1720: log("Trying to verify the dialog...\n");
1721: update.verify();
1722:
1723: log("Executing command....\n");
1724: update.runCommand();
1725:
1726: log("The 'Output of VCS Commands [' should be opened...\n");
1727: // No jelly2 UpdateDialogOperator
1728: OutputOfVCSCommandsFrame out = new OutputOfVCSCommandsFrame();
1729: log("Trying to verify the dialog\n");
1730: out.verify();
1731: log("Trying to close the dialog using 'Close' button\n");
1732: out.close();
1733:
1734: log("Trying to select node in the explorer:\n"
1735: + getTestDirNodePath() + "|"
1736: + getTestFileObjectName() + " [Up-to-date; 1.2]");
1737: new Node(rootNode, getTestDirNodePath() + "|"
1738: + getTestFileObjectName() + " [Up-to-date; 1.2]")
1739: .select();
1740:
1741: //exp=new Explorer();
1742: log("Trying to switch to Versioning TAB\n");
1743: switchToTab(exp, versioning);
1744: jtro = new JTreeOperator(JTreeOperator.waitJTree(
1745: (Container) exp.tbpExplorerTabPane().getSource(),
1746: versioning, true, true, 0));
1747:
1748: sbt.start();
1749: log("Trying to push PopupMenu:\n"
1750: + merge
1751: + "\non the node in VE:\n"
1752: + getTestDirNodePath()
1753: + "|"
1754: + getTestFileObjectName()
1755: + ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)");
1756: new JCVSMergeWithRevisionAction()
1757: .perform(new Node(
1758: jtro,
1759: getTestDirNodePath()
1760: + "|"
1761: + getTestFileObjectName()
1762: + ".java [Up-to-date; 1.2]|1.2 <Default Group> |1.2.2 (vetev2)"));
1763:
1764: //Please correct text which is compaered in statusline after merge!!!!
1765: log("WARNING TO DEVELOPERS:\nPlease correct 'mergre' text in status line o MainWindow!!!");
1766: System.out
1767: .println("Jaky je text v Main Window status Line?");
1768: System.out.println(sbt.getStatusTextHistory().toString());
1769: sbt.contains("Merge:finished...", true);
1770: sbt.stop();
1771:
1772: log("Merge With Revision seems succeeded...\n");
1773:
1774: log("Trying to push PopupMenu:\n" + CVS + "|" + commitCmd
1775: + "\non the node:\n" + getTestDirNodePath() + "|"
1776: + getTestFileObjectName() + ".java [LMod; 1.2]");
1777: new JCVSCommitAction().perform(new Node(jtro,
1778: getTestDirNodePath() + "|"
1779: + getTestFileObjectName()
1780: + ".java [LMod; 1.2]"));
1781:
1782: log("Invoking Commit dialog");
1783: // No jelly2 CommitDialogOperator
1784: CommitDialog commit = new CommitDialog();
1785:
1786: log("Typing a message:\nMerged with branch.\n");
1787: commit.txtMessage().setText("Merged with branch.");
1788:
1789: log("Trying to verify the dialog\n");
1790: commit.verify();
1791:
1792: log("Trying to execute the command\n");
1793: commit.runCommand();
1794:
1795: log("Invoking the 'Ouptut of VCS Commands [' dialog\n");
1796: out = new OutputOfVCSCommandsFrame();
1797:
1798: log("Trying to verify the dialog\n");
1799: out.verify();
1800:
1801: log("Closing the dialog\n");
1802: out.close();
1803:
1804: log("Selecting a node:\n" + getTestDirNodePath() + "|"
1805: + getTestFileObjectName()
1806: + ".java [Up-to-date; 1.3]\n");
1807: new Node(jtro, getTestDirNodePath() + "|"
1808: + getTestFileObjectName()
1809: + ".java [Up-to-date; 1.3]").select();
1810: endTest();
1811:
1812: log("Trying to switch to FS Tab\n");
1813: exp.selectPageFilesystems();
1814: } catch (Exception e) {
1815: fail(e);
1816: }
1817: }
1818:
1819: /** performs Status command on testfile and looks for "Up-to-date" and "1.3" labels inside output frame
1820: * @throws Exception any unexpected exception thrown during test
1821: * @see #testMerge depends on: testMerge
1822: * @see #testLog <br>next: testLog
1823: */
1824: public void testStatus() {
1825: startTest();
1826: strCmdAction = Bundle.getStringTrimmed(
1827: "org.netbeans.modules.cvsclient.actions.Bundle",
1828: "LBL_JStatusAction")
1829: + "...";
1830: String versioning = Bundle.getStringTrimmed(
1831: "org.netbeans.modules.vcscore.versioning.impl.Bundle",
1832: "versioningSystemName");
1833: CVS = Bundle
1834: .getStringTrimmed(
1835: "org.netbeans.modules.vcscore.wizard.mountcvs.Bundle",
1836: "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1837: try {
1838: ExplorerOperator exp = new ExplorerOperator();
1839: Node rootNode = exp.invoke().repositoryTab().getRootNode();
1840: // MainWindowOperator.StatusTextTracer sbt = MainWindowOperator.getDefault().getStatusTextTracer();
1841: Node node = null;
1842: JTreeOperator jtro = null;
1843:
1844: log("Trying to switch to Versioning TAB\n");
1845: switchToTab(exp, versioning);
1846:
1847: log("Trying to push PopupMenu:\n" + CVS + "|"
1848: + strCmdAction + "\non the node:\n"
1849: + getTestDirNodePath() + "|"
1850: + getTestFileObjectName()
1851: + ".java [Up-to-date; 1.3]\n");
1852: jtro = new JTreeOperator(JTreeOperator.waitJTree(
1853: (Container) exp.tbpExplorerTabPane().getSource(),
1854: versioning, true, true, 0));
1855: new JCVSStatusAction().perform(new Node(jtro,
1856: getTestDirNodePath() + "|"
1857: + getTestFileObjectName()
1858: + ".java [Up-to-date; 1.3]"));
1859:
1860: log("Invoking command dialog...\n");
1861: // No jelly2 StatusDialogOperator
1862: StatusDialog dlg = new StatusDialog();
1863:
1864: log("Verifying the dialog...\n");
1865: dlg.verify();
1866:
1867: log("Executing the command...\n");
1868: dlg.runCommand();
1869:
1870: log("Looking for 'CVS Output [Status - testfile.java]' dialog....\nbut sometimes it might happen"
1871: + "that command name and file is ommited:-((((...In this case...\n test would fail\nsee P2 #26842 bug at: "
1872: + "http://www.netbeans.org/issues/show_bug.cgi?id=26842\nand write your experiences in to it, please:\n");
1873: StatusOutputOperator out = new StatusOutputOperator(
1874: "testfile.java");
1875:
1876: log("Status output dialog contains:");
1877: log(out.getStatus());
1878: log(out.getFilename());
1879: log(out.getRepositoryFile());
1880: log(out.getWorkingRevision());
1881: log(out.getRepositoryRevision());
1882: log(out.getStickyTag());
1883: log(out.getStickyOptions() + "\n");
1884:
1885: log("psRef=" + psRef.toString());
1886: log("repositoryprefix=" + repositoryprefix);
1887: out.dumpFile(psRef, repositoryprefix);
1888: out.close();
1889: compareReferenceFiles();
1890:
1891: log("Trying to switch to FS Tab\n");
1892: exp.selectPageFilesystems();
1893: endTest();
1894: } catch (Exception e) {
1895: fail(e);
1896: }
1897: }
1898:
1899: /** performs Log command on testfile and looks for "1.3" label inside output frame
1900: * @throws Exception any unexpected exception thrown during test
1901: * @see #testStatus depends on: testStatus
1902: * @see #testAnnotate <br>next: testAnnotate
1903: */
1904: public void testLog() {
1905: clearTestStatus();
1906: startTest();
1907: strCmdAction = Bundle.getStringTrimmed(
1908: "org.netbeans.modules.cvsclient.actions.Bundle",
1909: "LBL_JLogAction")
1910: + "...";
1911: String versioning = Bundle.getStringTrimmed(
1912: "org.netbeans.modules.vcscore.versioning.impl.Bundle",
1913: "versioningSystemName");
1914: CVS = Bundle
1915: .getStringTrimmed(
1916: "org.netbeans.modules.vcscore.wizard.mountcvs.Bundle",
1917: "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1918: try {
1919: ExplorerOperator exp = new ExplorerOperator();
1920: Node rootNode = exp.invoke().repositoryTab().getRootNode();
1921: Node node = null;
1922: JTreeOperator jtro = null;
1923:
1924: log("Trying to switch to Verifying TAB\n");
1925: switchToTab(exp, versioning);
1926:
1927: jtro = new JTreeOperator(JTreeOperator.waitJTree(
1928: (Container) exp.tbpExplorerTabPane().getSource(),
1929: versioning, true, true, 0));
1930: node = new Node(jtro, getTestDirNodePath() + "|"
1931: + getTestFileObjectName()
1932: + ".java [Up-to-date; 1.3]");
1933:
1934: log("Trying to push PopupMenu:\n" + CVS + "|"
1935: + strCmdAction + "\non the node:\n"
1936: + node.getPath());
1937: new JCVSLogAction().perform(node);
1938:
1939: log("Opening the input dialog for log command...\n");
1940: // No jelly2 LogDialogOperator
1941: LogDialog dlg = new LogDialog();
1942:
1943: log("Verifying the dialog...\n");
1944: dlg.verify();
1945:
1946: log("Exception the command...\n");
1947: dlg.runCommand();
1948:
1949: log("Looking for 'CVS Output [Log - testfile.java]' dialog....\nbut sometimes it might happen"
1950: + "that command name and file is ommited:-((((...In this case...\n test would fail\nsee P2 bug at: "
1951: + "http://www.netbeans.org/issues/show_bug.cgi?id=26842\nand write your experiences in to it, please:\n");
1952: LogOutputOperator out = new LogOutputOperator(
1953: "testfile.java", false, false);
1954:
1955: log("Log output dialog contains:");
1956: log(out.getFilename());
1957: log(out.getLocks());
1958: log(out.getRepositoryFile());
1959: log(out.getHeadRevision());
1960: log(out.getSelectedRevisions());
1961: log(out.getOutOf());
1962: log(out.getLogMessage() + "\n");
1963:
1964: log("psRef=" + psRef.toString());
1965: log("repositoryprefix=" + repositoryprefix);
1966: out.dumpFile(psRef, repositoryprefix);
1967: compareReferenceFiles();
1968:
1969: log("Closing the dialog...\n");
1970: out.close();
1971: endTest();
1972:
1973: log("Trying to switch to FS TAB\n");
1974: exp.selectPageFilesystems();
1975: } catch (Exception e) {
1976: fail(e);
1977: }
1978: }
1979:
1980: /** performs Annotate command on testfile and looks for output
1981: * @throws Exception any unexpected exception thrown during test
1982: * @see #testLog depends on: testLog
1983: * @see #testUnmount <br>next: testUnmount
1984: */
1985: public void testAnnotate() {
1986: clearTestStatus();
1987: startTest();
1988: strCmdAction = Bundle.getStringTrimmed(
1989: "org.netbeans.modules.cvsclient.actions.Bundle",
1990: "LBL_JAnnotateAction")
1991: + "...";
1992: String versioning = Bundle.getStringTrimmed(
1993: "org.netbeans.modules.vcscore.versioning.impl.Bundle",
1994: "versioningSystemName");
1995: CVS = Bundle
1996: .getStringTrimmed(
1997: "org.netbeans.modules.vcscore.wizard.mountcvs.Bundle",
1998: "Templates/Mount/VCS/org-netbeans-modules-vcscore-wizard-mountcvs-CvsMountFS.settings");
1999: try {
2000: ExplorerOperator exp = new ExplorerOperator();
2001: Node rootNode = exp.invoke().repositoryTab().getRootNode();
2002: Node node = null;
2003: JTreeOperator jtro = null;
2004:
2005: log("Trying to switch to Versioning TAB\n");
2006: switchToTab(exp, versioning);
2007:
2008: log("Trying to push PopupMenu:\n" + CVS + "|"
2009: + strCmdAction + "\non the node:\n"
2010: + getTestDirNodePath() + "|"
2011: + getTestFileObjectName()
2012: + ".java [Up-to-date; 1.3]");
2013:
2014: jtro = new JTreeOperator(JTreeOperator.waitJTree(
2015: (Container) exp.tbpExplorerTabPane().getSource(),
2016: versioning, true, true, 0));
2017: new JCVSAnnotateAction().perform(new Node(jtro,
2018: getTestDirNodePath() + "|"
2019: + getTestFileObjectName()
2020: + ".java [Up-to-date; 1.3]"));
2021:
2022: log("Opening the input command dialog...\n");
2023: // No jelly2 AnnotateDialogOperator
2024: AnnotateDialog dlg = new AnnotateDialog();
2025:
2026: log("Trying to verify the dialog...\n");
2027: dlg.verify();
2028:
2029: log("Explorer the log command...\n");
2030: dlg.runCommand();
2031:
2032: log("Looking for 'CVS Output [Annotate - testfile.java]' dialog.... and traying it to close,\nbut sometimes it might happen"
2033: + "that command name and file is ommited:-((((...In this case...\n test would fail\nsee P2 bug at: "
2034: + "http://www.netbeans.org/issues/show_bug.cgi?id=26842\nand write your experiences in to it, please:\n");
2035: new FrameOperator("CVS Output [Annotate testfile.java]")
2036: .close();
2037: endTest();
2038:
2039: log("Trying to switch to FS TAB\n");
2040: exp.selectPageFilesystems();
2041: } catch (Exception e) {
2042: fail(e);
2043: }
2044: }
2045:
2046: /** unmounts CVS filesystem using its popup menu
2047: * @throws Exception any unexpected exception thrown during test
2048: * @see #testAnnotate depends on: testAnnotate
2049: * @see #testUndock <br>next: testUndock
2050: */
2051: public void testUnmount() {
2052: clearTestStatus();
2053: startTest();
2054: CVS = Bundle.getStringTrimmed(
2055: "org.netbeans.modules.javacvs.Bundle",
2056: "JavaCvsFileSystem.validFilesystemLabel");
2057: String umountFS = Bundle.getStringTrimmed(
2058: "org.netbeans.core.actions.Bundle", "UnmountFS");
2059: try {
2060: ExplorerOperator exp = new ExplorerOperator();
2061: Node rootNode = exp.invoke().repositoryTab().getRootNode();
2062: Node node = null;
2063: // JTreeOperator jtro = null;
2064:
2065: log("Trying to get focus to Explorer\n");
2066: exp.getFocus();
2067:
2068: // log("Trying to switch to FileSystems TAB");
2069: // exp.selectPageFilesystems();
2070:
2071: node = new Node(rootNode, CVS
2072: + getJavaCVSWork().getAbsolutePath());
2073: log("Trying to push PopupMenu:\n" + umountFS
2074: + "\non the node:\n" + node + "\n");
2075: new UnmountFSAction().perform(node);
2076: log("DONE:)");
2077: endTest();
2078: } catch (Exception e) {
2079: fail(e);
2080: }
2081: }
2082:
2083: /** undocks VCS Groups and Versioning frames from Explorer and closes them
2084: * @throws Exception any unexpected exception thrown during test
2085: * @see #testUnmount depends on: testUnmount
2086: */
2087: public void testUndock() {
2088: clearTestStatus();
2089: startTest();
2090: String vcsGrpTAB = Bundle.getStringTrimmed(
2091: "org.netbeans.modules.vcscore.grouping.Bundle",
2092: "LBL_MODE.title");
2093: String versTAB = Bundle.getStringTrimmed(
2094: "org.netbeans.modules.vcscore.versioning.impl.Bundle",
2095: "versioningSystemName");
2096: try {
2097: ExplorerOperator exp = new ExplorerOperator();
2098: Node rootNode = exp.invoke().repositoryTab().getRootNode();
2099: Node node = null;
2100: // JTreeOperator jtro = null;
2101: JFrameOperator jfo = null;
2102:
2103: log("Trying to activate the Explorer...\n");
2104: exp.getFocus();
2105: //Excersising with the Explorer to correctly undock VCS Groups TAB
2106: Thread.sleep(2500);
2107:
2108: log("Trying to switch to FS TAB\n");
2109: exp.selectPageFilesystems();
2110: //Excersising with the Explorer to correctly undock VCS Groups TAB
2111: Thread.sleep(2500);
2112:
2113: log("Trying to switch to '" + vcsGrpTAB + "' TAB\n");
2114: switchToTab(exp, vcsGrpTAB);
2115:
2116: log("Trying to push MainMenu:\"+ 'Window||Undock View'\n");
2117: // MainWindowOperator.getDefault();
2118: new UndockAction().perform();
2119:
2120: log("...now the VCSGroupFrame should be undock....and we'return closing it...\n");
2121: new VCSGroupsFrameOperator().close();
2122:
2123: //exp=new Explorer();
2124: log("Trying to activate the Explorer...\n");
2125: // new JFrameOperator(exp.getJFrame()).activate();
2126: exp.getFocus();
2127:
2128: log("Trying to switch to '" + versTAB + "' TAB\n");
2129: switchToTab(exp, versTAB);
2130: // MainFrame.getMainFrame().pushMenu("Window|Undock View");
2131: new UndockAction().perform();
2132: new VersioningFrameOperator().close();
2133: endTest();
2134: } catch (Exception e) {
2135: fail(e);
2136: }
2137: }
2138: }
|