Source Code Cross Referenced for StandardWorkFlow.java in  » IDE-Netbeans » versioning » org » netbeans » test » cvsmodule » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » versioning » org.netbeans.test.cvsmodule 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * StandardWorkFlow.java
0003:         * 
0004:         * Created on 26 October 2005, 19:34
0005:         *
0006:         * To change this template, choose Tools | Template Manager
0007:         * and open the template in the editor.
0008:         */
0009:        package org.netbeans.test.cvsmodule;
0010:
0011:        import java.io.BufferedReader;
0012:        import java.io.File;
0013:        import java.io.FileReader;
0014:        import java.io.InputStream;
0015:        import javax.swing.ListModel;
0016:        import javax.swing.table.TableModel;
0017:        import junit.textui.TestRunner;
0018:        import org.netbeans.jellytools.EditorOperator;
0019:        import org.netbeans.jellytools.JellyTestCase;
0020:        import org.netbeans.jellytools.NbDialogOperator;
0021:        import org.netbeans.jellytools.OutputOperator;
0022:        import org.netbeans.jellytools.OutputTabOperator;
0023:        import org.netbeans.jellytools.ProjectsTabOperator;
0024:        import org.netbeans.jellytools.modules.javacvs.BranchOperator;
0025:        import org.netbeans.jellytools.modules.javacvs.CVSRootStepOperator;
0026:        import org.netbeans.jellytools.modules.javacvs.CheckoutWizardOperator;
0027:        import org.netbeans.jellytools.modules.javacvs.CommitOperator;
0028:        import org.netbeans.jellytools.modules.javacvs.DiffOperator;
0029:        import org.netbeans.jellytools.modules.javacvs.ModuleToCheckoutStepOperator;
0030:        import org.netbeans.jellytools.modules.javacvs.SearchHistoryOperator;
0031:        import org.netbeans.jellytools.modules.javacvs.SwitchToBranchOperator;
0032:        import org.netbeans.jellytools.modules.javacvs.VersioningOperator;
0033:        import org.netbeans.jellytools.nodes.Node;
0034:        import org.netbeans.jellytools.nodes.SourcePackagesNode;
0035:        import org.netbeans.jemmy.QueueTool;
0036:        import org.netbeans.jemmy.TimeoutExpiredException;
0037:        import org.netbeans.jemmy.operators.JButtonOperator;
0038:        import org.netbeans.jemmy.operators.JListOperator;
0039:        import org.netbeans.jemmy.operators.JProgressBarOperator;
0040:        import org.netbeans.jemmy.operators.JTableOperator;
0041:        import org.netbeans.jemmy.operators.JTextFieldOperator;
0042:        import org.netbeans.jemmy.operators.Operator;
0043:        import org.netbeans.jemmy.operators.Operator.DefaultStringComparator;
0044:        import org.netbeans.junit.NbTestSuite;
0045:        import org.netbeans.junit.ide.ProjectSupport;
0046:
0047:        /**
0048:         *
0049:         * @author peter
0050:         */
0051:        public class StandardWorkFlow extends JellyTestCase {
0052:
0053:            String os_name;
0054:            static String sessionCVSroot;
0055:            final String projectName = "ForImport";
0056:            final String pathToMain = "forimport|Main.java";
0057:            final String PROTOCOL_FOLDER = "protocol";
0058:            static File cacheFolder;
0059:            Operator.DefaultStringComparator comOperator;
0060:            Operator.DefaultStringComparator oldOperator;
0061:
0062:            /**
0063:             * Creates a new instance of CheckOutWizardTest
0064:             */
0065:            public StandardWorkFlow(String name) {
0066:                super (name);
0067:            }
0068:
0069:            /**
0070:             * @param args the command line arguments
0071:             */
0072:            public static void main(String[] args) {
0073:                // TODO code application logic here
0074:                TestRunner.run(suite());
0075:            }
0076:
0077:            public static NbTestSuite suite() {
0078:                NbTestSuite suite = new NbTestSuite();
0079:                suite.addTest(new StandardWorkFlow("testCheckOutProject"));
0080:                suite.addTest(new StandardWorkFlow("testIgnoreUnignoreFile"));
0081:                suite
0082:                        .addTest(new StandardWorkFlow(
0083:                                "testIgnoreUnignoreGuiForm"));
0084:                suite.addTest(new StandardWorkFlow("testCommit"));
0085:                suite
0086:                        .addTest(new StandardWorkFlow(
0087:                                "testCreateBranchForProject"));
0088:                suite
0089:                        .addTest(new StandardWorkFlow(
0090:                                "testSwitchProjectToBranch"));
0091:                suite.addTest(new StandardWorkFlow("testDiffFile"));
0092:                suite.addTest(new StandardWorkFlow("testExportDiffPatch"));
0093:                suite.addTest(new StandardWorkFlow("testResolveConflicts"));
0094:                suite.addTest(new StandardWorkFlow("testRevertModifications"));
0095:                suite.addTest(new StandardWorkFlow("testShowAnnotations"));
0096:                suite.addTest(new StandardWorkFlow("testSearchHistory"));
0097:                suite.addTest(new StandardWorkFlow("testVersioningButtons"));
0098:                suite.addTest(new StandardWorkFlow("testRemoveFileGetBack"));
0099:                suite.addTest(new StandardWorkFlow("testRemoveFileCommit"));
0100:                suite.addTest(new StandardWorkFlow("removeAllData"));
0101:                return suite;
0102:            }
0103:
0104:            protected void setUp() throws Exception {
0105:
0106:                os_name = System.getProperty("os.name");
0107:                //System.out.println(os_name);
0108:                System.out.println("### " + getName() + " ###");
0109:
0110:            }
0111:
0112:            protected boolean isUnix() {
0113:                boolean unix = false;
0114:                if (os_name.indexOf("Windows") == -1) {
0115:                    unix = true;
0116:                }
0117:                return unix;
0118:            }
0119:
0120:            public void testCheckOutProject() throws Exception {
0121:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
0122:                //JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
0123:                OutputOperator oo = OutputOperator.invoke();
0124:                new ProjectsTabOperator().tree().clearSelection();
0125:                comOperator = new Operator.DefaultStringComparator(true, true);
0126:                oldOperator = (DefaultStringComparator) Operator
0127:                        .getDefaultStringComparator();
0128:                Operator.setDefaultStringComparator(comOperator);
0129:                CheckoutWizardOperator cwo = CheckoutWizardOperator.invoke();
0130:                Operator.setDefaultStringComparator(oldOperator);
0131:                CVSRootStepOperator crso = new CVSRootStepOperator();
0132:                //JComboBoxOperator combo = new JComboBoxOperator(crso, 0);
0133:                crso.setCVSRoot(":pserver:anoncvs@localhost:/cvs");
0134:                //crso.setPassword("");
0135:                //crso.setPassword("test");
0136:
0137:                //prepare stream for successful authentification and run PseudoCVSServer
0138:                InputStream in = TestKit.getStream(getDataDir()
0139:                        .getCanonicalFile().toString()
0140:                        + File.separator + PROTOCOL_FOLDER, "authorized.in");
0141:                PseudoCvsServer cvss = new PseudoCvsServer(in);
0142:                new Thread(cvss).start();
0143:                cvss.ignoreProbe();
0144:                String CVSroot = cvss.getCvsRoot();
0145:                sessionCVSroot = CVSroot;
0146:                //System.out.println(sessionCVSroot);
0147:                crso.setCVSRoot(CVSroot);
0148:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0149:                        CVSroot);
0150:                crso.next();
0151:
0152:                //second step of checkoutwizard
0153:                //2nd step of CheckOutWizard
0154:
0155:                File tmp = new File("/tmp"); // NOI18N
0156:                File work = new File(tmp, "" + File.separator
0157:                        + System.currentTimeMillis());
0158:                cacheFolder = new File(work, projectName + File.separator
0159:                        + "src" + File.separator + "forimport" + File.separator
0160:                        + "CVS" + File.separator + "RevisionCache");
0161:                tmp.mkdirs();
0162:                work.mkdirs();
0163:                tmp.deleteOnExit();
0164:                ModuleToCheckoutStepOperator moduleCheck = new ModuleToCheckoutStepOperator();
0165:                cvss.stop();
0166:                in.close();
0167:                moduleCheck.setModule("ForImport");
0168:                moduleCheck.setLocalFolder(work.getAbsolutePath()); // NOI18N
0169:
0170:                //Pseudo CVS server for finishing check out wizard
0171:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0172:                        .toString()
0173:                        + File.separator + PROTOCOL_FOLDER,
0174:                        "checkout_finish_2.in");
0175:                cvss = new PseudoCvsServer(in);
0176:                new Thread(cvss).start();
0177:                CVSroot = cvss.getCvsRoot();
0178:                //cvss.ignoreProbe();
0179:
0180:                //crso.setCVSRoot(CVSroot);
0181:                //combo.setSelectedItem(CVSroot);
0182:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0183:                        CVSroot);
0184:                cwo.finish();
0185:
0186:                //System.out.println(CVSroot);
0187:
0188:                OutputTabOperator oto = new OutputTabOperator(sessionCVSroot);
0189:                oto.getTimeouts().setTimeout(
0190:                        "ComponentOperator.WaitStateTimeout", 30000);
0191:                oto.waitText("Checking out finished");
0192:                cvss.stop();
0193:                in.close();
0194:                NbDialogOperator nbdialog = new NbDialogOperator(
0195:                        "Checkout Completed");
0196:                JButtonOperator open = new JButtonOperator(nbdialog,
0197:                        "Open Project");
0198:                open.push();
0199:
0200:                ProjectSupport.waitScanFinished();
0201:                TestKit.waitForQueueEmpty();
0202:                ProjectSupport.waitScanFinished();
0203:
0204:                //create new elements for testing
0205:                TestKit.createNewElements(projectName);
0206:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0207:            }
0208:
0209:            public void testIgnoreUnignoreFile() throws Exception {
0210:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 3000);
0211:                VersioningOperator vo;
0212:                //OutputOperator oo;
0213:                OutputTabOperator oto;
0214:                InputStream in;
0215:                PseudoCvsServer cvss;
0216:                String CVSroot;
0217:                JTableOperator table;
0218:                org.openide.nodes.Node nodeIDE;
0219:                String color;
0220:
0221:                Node nodeClass = new Node(new SourcePackagesNode(projectName),
0222:                        "xx|NewClass.java");
0223:                nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
0224:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0225:                assertEquals("Wrong color for new file", TestKit.NEW_COLOR,
0226:                        color);
0227:
0228:                //show changes stream for pseudocvsserver
0229:                //oo = OutputOperator.invoke();
0230:                //System.out.println(sessionCVSroot);
0231:                oto = new OutputTabOperator(sessionCVSroot);
0232:                oto.getTimeouts().setTimeout(
0233:                        "ComponentOperator.WaitStateTimeout", 30000);
0234:                oto.clear();
0235:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0236:                        .toString()
0237:                        + File.separator + PROTOCOL_FOLDER,
0238:                        "show_changes_for_file");
0239:                cvss = new PseudoCvsServer(in);
0240:                new Thread(cvss).start();
0241:                CVSroot = cvss.getCvsRoot();
0242:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0243:                        CVSroot);
0244:                nodeClass.performPopupAction("CVS|Show Changes");
0245:                Thread.sleep(1000);
0246:                vo = VersioningOperator.invoke();
0247:                table = vo.tabFiles();
0248:                //System.out.println(""+table);
0249:                oto.waitText("Refreshing CVS Status finished");
0250:                Thread.sleep(1000);
0251:                assertEquals("Wrong row count of table.", 1, table
0252:                        .getRowCount());
0253:                assertEquals("Wrong file listed in table.", "NewClass.java",
0254:                        table.getValueAt(0, 0).toString());
0255:                cvss.stop();
0256:
0257:                //ignore java file
0258:                //oo = OutputOperator.invoke();
0259:                oto = new OutputTabOperator(sessionCVSroot);
0260:                oto.clear();
0261:                nodeClass.performPopupAction("CVS|Ignore");
0262:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0263:                        .toString()
0264:                        + File.separator + PROTOCOL_FOLDER,
0265:                        "show_changes_for_file");
0266:                cvss = new PseudoCvsServer(in);
0267:                new Thread(cvss).start();
0268:                CVSroot = cvss.getCvsRoot();
0269:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0270:                        CVSroot);
0271:                //nodeClass.performPopupAction("CVS|Show Changes");
0272:
0273:                Thread.sleep(1000);
0274:                assertEquals("File should not be listed in table", 0, table
0275:                        .getRowCount());
0276:                cvss.stop();
0277:
0278:                nodeClass = new Node(new SourcePackagesNode(projectName),
0279:                        "xx|NewClass.java");
0280:                nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
0281:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0282:                assertEquals("Wrong color for new file", TestKit.IGNORED_COLOR,
0283:                        color);
0284:
0285:                //unignore java file
0286:                //oo = OutputOperator.invoke();
0287:                //oto = oo.getOutputTab(sessionCVSroot);
0288:                oto.clear();
0289:                nodeClass.performPopupAction("CVS|Unignore");
0290:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0291:                        .toString()
0292:                        + File.separator + PROTOCOL_FOLDER,
0293:                        "show_changes_for_file");
0294:                cvss = new PseudoCvsServer(in);
0295:                new Thread(cvss).start();
0296:                CVSroot = cvss.getCvsRoot();
0297:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0298:                        CVSroot);
0299:                nodeClass.performPopupAction("CVS|Show Changes");
0300:                oto.waitText("Refreshing CVS Status finished");
0301:                Thread.sleep(1000);
0302:                assertEquals("File should not be listed in table", 1, table
0303:                        .getRowCount());
0304:                cvss.stop();
0305:
0306:                nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
0307:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0308:                assertEquals("Wrong color for new file", TestKit.NEW_COLOR,
0309:                        color);
0310:
0311:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0312:            }
0313:
0314:            public void testIgnoreUnignoreGuiForm() throws Exception {
0315:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 3000);
0316:                VersioningOperator vo;
0317:                //OutputOperator oo;
0318:                OutputTabOperator oto;
0319:                InputStream in;
0320:                PseudoCvsServer cvss;
0321:                String CVSroot;
0322:                JTableOperator table;
0323:                org.openide.nodes.Node nodeIDE;
0324:                String color;
0325:                Object[] expected;
0326:                Object[] actual;
0327:
0328:                Node nodeFrame = new Node(new SourcePackagesNode(projectName),
0329:                        "xx|NewJFrame.java");
0330:                nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
0331:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0332:                assertEquals("Wrong color for new file", TestKit.NEW_COLOR,
0333:                        color);
0334:
0335:                //show changes stream for pseudocvsserver
0336:                //oo = OutputOperator.invoke();
0337:                //System.out.println(sessionCVSroot);
0338:                oto = new OutputTabOperator(sessionCVSroot);
0339:                oto.getTimeouts().setTimeout(
0340:                        "ComponentOperator.WaitStateTimeout", 30000);
0341:                oto.clear();
0342:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0343:                        .toString()
0344:                        + File.separator + PROTOCOL_FOLDER,
0345:                        "show_changes_for_jframe");
0346:                cvss = new PseudoCvsServer(in);
0347:                new Thread(cvss).start();
0348:                CVSroot = cvss.getCvsRoot();
0349:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0350:                        CVSroot);
0351:                nodeFrame.performPopupAction("CVS|Show Changes");
0352:                Thread.sleep(1000);
0353:                vo = VersioningOperator.invoke();
0354:                table = vo.tabFiles();
0355:                //System.out.println(""+table);
0356:                oto.waitText("Refreshing CVS Status finished");
0357:                Thread.sleep(1000);
0358:                //assertEquals("Wrong row count of table.", 1, table.getRowCount());
0359:                //assertEquals("Wrong file listed in table.", "NewClass.java", table.getValueAt(0, 0).toString());
0360:                cvss.stop();
0361:                TableModel model = table.getModel();
0362:
0363:                expected = new String[] { "NewJFrame.form", "NewJFrame.java" };
0364:                actual = new String[model.getRowCount()];
0365:                for (int i = 0; i < actual.length; i++) {
0366:                    actual[i] = model.getValueAt(i, 0).toString();
0367:                }
0368:                int result = TestKit.compareThem(expected, actual, false);
0369:                assertEquals("Wrong files in view", 2, result);
0370:
0371:                //ignore java file
0372:                //oo = OutputOperator.invoke();
0373:                //oto = oo.getOutputTab(sessionCVSroot);
0374:                oto = new OutputTabOperator(sessionCVSroot);
0375:                oto.clear();
0376:                nodeFrame.performPopupAction("CVS|Ignore");
0377:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0378:                        .toString()
0379:                        + File.separator + PROTOCOL_FOLDER,
0380:                        "show_changes_for_jframe");
0381:                cvss = new PseudoCvsServer(in);
0382:                new Thread(cvss).start();
0383:                CVSroot = cvss.getCvsRoot();
0384:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0385:                        CVSroot);
0386:                //nodeFrame.performPopupAction("CVS|Show Changes");
0387:
0388:                Thread.sleep(1000);
0389:                assertEquals("File should not be listed in table", 0, table
0390:                        .getRowCount());
0391:                cvss.stop();
0392:
0393:                nodeFrame = new Node(new SourcePackagesNode(projectName),
0394:                        "xx|NewJFrame.java");
0395:                nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
0396:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0397:                assertEquals("Wrong color for new file", TestKit.IGNORED_COLOR,
0398:                        color);
0399:
0400:                //unignore java file
0401:                //oo = OutputOperator.invoke();
0402:                //oto = oo.getOutputTab(sessionCVSroot);
0403:                oto = new OutputTabOperator(sessionCVSroot);
0404:                oto.clear();
0405:                nodeFrame.performPopupAction("CVS|Unignore");
0406:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0407:                        .toString()
0408:                        + File.separator + PROTOCOL_FOLDER,
0409:                        "show_changes_for_jframe");
0410:                cvss = new PseudoCvsServer(in);
0411:                new Thread(cvss).start();
0412:                CVSroot = cvss.getCvsRoot();
0413:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0414:                        CVSroot);
0415:                nodeFrame.performPopupAction("CVS|Show Changes");
0416:                oto.waitText("Refreshing CVS Status finished");
0417:                Thread.sleep(1000);
0418:                assertEquals("File should not be listed in table", 2, table
0419:                        .getRowCount());
0420:                cvss.stop();
0421:
0422:                nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
0423:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0424:                assertEquals("Wrong color for new file", TestKit.NEW_COLOR,
0425:                        color);
0426:
0427:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0428:            }
0429:
0430:            public void testCommit() throws Exception {
0431:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
0432:                //JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 18000);
0433:                PseudoCvsServer cvss, cvss2, cvss3, cvss4;
0434:                InputStream in, in2, in3, in4;
0435:                CommitOperator co;
0436:                String CVSroot, color;
0437:                JTableOperator table;
0438:                //OutputOperator oo;
0439:                OutputTabOperator oto;
0440:                VersioningOperator vo;
0441:                String[] expected;
0442:                String[] actual;
0443:                String allCVSRoots;
0444:                org.openide.nodes.Node nodeIDE;
0445:
0446:                oto = new OutputTabOperator(sessionCVSroot);
0447:                oto.getTimeouts().setTimeout(
0448:                        "ComponentOperator.WaitStateTimeout", 30000);
0449:
0450:                Node packNode = new Node(new SourcePackagesNode("ForImport"),
0451:                        "xx");
0452:                //
0453:                Node nodeClass = new Node(new SourcePackagesNode("ForImport"),
0454:                        "xx|NewClass.java");
0455:                nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
0456:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0457:                assertEquals("Wrong color for new file", TestKit.NEW_COLOR,
0458:                        color);
0459:                //
0460:
0461:                Node nodeFrame = new Node(new SourcePackagesNode("ForImport"),
0462:                        "xx|NewJFrame.java");
0463:                nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
0464:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0465:                assertEquals("Wrong color for new file", TestKit.NEW_COLOR,
0466:                        color);
0467:                //
0468:
0469:                co = CommitOperator.invoke(packNode);
0470:                Thread.sleep(1000);
0471:                table = co.tabFiles();
0472:                TableModel model = table.getModel();
0473:
0474:                expected = new String[] { "NewClass.java", "NewJFrame.form",
0475:                        "NewJFrame.java" };
0476:                actual = new String[model.getRowCount()];
0477:                for (int i = 0; i < actual.length; i++) {
0478:                    actual[i] = model.getValueAt(i, 0).toString();
0479:                }
0480:                int result = TestKit.compareThem(expected, actual, false);
0481:                assertEquals("Wrong records displayed in dialog", 3, result);
0482:                co.setCommitMessage("Initial commit message");
0483:
0484:                //oo = OutputOperator.invoke();
0485:
0486:                //oto.clear();
0487:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0488:                        .toString()
0489:                        + File.separator + PROTOCOL_FOLDER, "commit_invoke.in");
0490:                cvss = new PseudoCvsServer(in);
0491:                new Thread(cvss).start();
0492:                allCVSRoots = cvss.getCvsRoot() + ",";
0493:
0494:                in2 = TestKit.getStream(getDataDir().getCanonicalFile()
0495:                        .toString()
0496:                        + File.separator + PROTOCOL_FOLDER,
0497:                        "commit_invoke_add.in");
0498:                cvss2 = new PseudoCvsServer(in2);
0499:                new Thread(cvss2).start();
0500:                allCVSRoots = allCVSRoots + cvss2.getCvsRoot() + ",";
0501:
0502:                in3 = TestKit.getStream(getDataDir().getCanonicalFile()
0503:                        .toString()
0504:                        + File.separator + PROTOCOL_FOLDER,
0505:                        "commit_invoke_commit.in");
0506:                cvss3 = new PseudoCvsServer(in3);
0507:                new Thread(cvss3).start();
0508:                allCVSRoots = allCVSRoots + cvss3.getCvsRoot() + ",";
0509:
0510:                in4 = TestKit
0511:                        .getStream(getDataDir().getCanonicalFile().toString()
0512:                                + File.separator + PROTOCOL_FOLDER,
0513:                                "checkout_final.in");
0514:                cvss4 = new PseudoCvsServer(in4);
0515:                new Thread(cvss4).start();
0516:                allCVSRoots = allCVSRoots + cvss4.getCvsRoot();
0517:
0518:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0519:                        allCVSRoots);
0520:                co.commit();
0521:                oto.waitText("Committing \"xx\" finished");
0522:
0523:                cvss.stop();
0524:                cvss2.stop();
0525:                cvss3.stop();
0526:                cvss4.stop();
0527:
0528:                nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
0529:                //color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0530:                assertNull("Wrong color of node!!!", nodeIDE
0531:                        .getHtmlDisplayName());
0532:
0533:                nodeIDE = (org.openide.nodes.Node) nodeFrame.getOpenideNode();
0534:                assertNull("Wrong color of node!!!", nodeIDE
0535:                        .getHtmlDisplayName());
0536:
0537:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0538:            }
0539:
0540:            public void testDiffFile() throws Exception {
0541:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
0542:                PseudoCvsServer cvss;
0543:                InputStream in;
0544:                //OutputOperator oo;
0545:                OutputTabOperator oto;
0546:                org.openide.nodes.Node nodeIDE;
0547:                String color;
0548:
0549:                oto = new OutputTabOperator(sessionCVSroot);
0550:                oto.getTimeouts().setTimeout(
0551:                        "ComponentOperator.WaitStateTimeout", 30000);
0552:
0553:                Node node = new Node(new SourcePackagesNode(projectName),
0554:                        pathToMain);
0555:                node.performPopupAction("Open");
0556:                EditorOperator eo = new EditorOperator("Main.java");
0557:                eo.deleteLine(2);
0558:                eo.insert(" insert", 5, 1);
0559:                eo.insert("\tSystem.out.println(\"\");\n", 19, 1);
0560:                eo.save();
0561:
0562:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0563:                        .toString()
0564:                        + File.separator + PROTOCOL_FOLDER, "diff_class.in");
0565:                cvss = new PseudoCvsServer(in);
0566:                new Thread(cvss).start();
0567:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
0568:                        .getCvsRoot());
0569:                node.performPopupAction("CVS|Diff...");
0570:                //oo = OutputOperator.invoke();
0571:
0572:                oto.waitText("Diffing \"Main.java\" finished");
0573:                Thread.sleep(1000);
0574:                cvss.stop();
0575:
0576:                Node nodeClass = new Node(new SourcePackagesNode(projectName),
0577:                        pathToMain);
0578:                nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
0579:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0580:                assertEquals("Wrong color for modified file",
0581:                        TestKit.MODIFIED_COLOR, color);
0582:
0583:                //verify next button
0584:                DiffOperator diffOp = new DiffOperator("Main.java");
0585:                //
0586:                try {
0587:                    TimeoutExpiredException afee = null;
0588:                    diffOp.next();
0589:                    diffOp.next();
0590:                    try {
0591:                        diffOp.next();
0592:                    } catch (TimeoutExpiredException e) {
0593:                        afee = e;
0594:                    }
0595:                    assertNotNull("TimeoutExpiredException was expected.", afee);
0596:
0597:                    //verify previous button
0598:                    afee = null;
0599:                    diffOp.previous();
0600:                    diffOp.previous();
0601:                    try {
0602:                        diffOp.previous();
0603:                    } catch (TimeoutExpiredException e) {
0604:                        afee = e;
0605:                    }
0606:                    assertNotNull("TimeoutExpiredException was expected.", afee);
0607:                } catch (Exception e) {
0608:                    System.out.println("Problem with buttons of differences");
0609:                }
0610:
0611:                //refresh button
0612:                //oo = OutputOperator.invoke();
0613:                //oto = oo.getOutputTab(sessionCVSroot);
0614:                oto = new OutputTabOperator(sessionCVSroot);
0615:                oto.clear();
0616:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0617:                        .toString()
0618:                        + File.separator + PROTOCOL_FOLDER, "diff/refresh.in");
0619:                cvss = new PseudoCvsServer(in);
0620:                new Thread(cvss).start();
0621:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
0622:                        .getCvsRoot());
0623:                diffOp.refresh();
0624:                oto.waitText("Refreshing CVS Status finished");
0625:                cvss.stop();
0626:                Thread.sleep(1000);
0627:
0628:                //update button
0629:                //oo = OutputOperator.invoke();
0630:                //oto = oo.getOutputTab(sessionCVSroot);
0631:                oto = new OutputTabOperator(sessionCVSroot);
0632:                oto.clear();
0633:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0634:                        .toString()
0635:                        + File.separator + PROTOCOL_FOLDER, "diff/refresh.in");
0636:                cvss = new PseudoCvsServer(in);
0637:                new Thread(cvss).start();
0638:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
0639:                        .getCvsRoot());
0640:                diffOp.update();
0641:                oto.waitText("Updating Sources finished");
0642:                cvss.stop();
0643:                Thread.sleep(1000);
0644:
0645:                //commit button
0646:                CommitOperator co = diffOp.commit();
0647:                JTableOperator table = co.tabFiles();
0648:                assertEquals("There should be only one file!", 1, table
0649:                        .getRowCount());
0650:                assertEquals("There should be Main.java file only!",
0651:                        "Main.java", table.getValueAt(0, 0));
0652:                co.cancel();
0653:
0654:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0655:                eo.closeAllDocuments();
0656:                TestKit.deleteRecursively(cacheFolder);
0657:            }
0658:
0659:            public void testExportDiffPatch() throws Exception {
0660:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
0661:                //JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 18000);
0662:                PseudoCvsServer cvss, cvss2, cvss3;
0663:                InputStream in, in2, in3;
0664:                //OutputOperator oo;
0665:                OutputTabOperator oto;
0666:                org.openide.nodes.Node nodeIDE;
0667:                String color, CVSroot;
0668:
0669:                oto = new OutputTabOperator(sessionCVSroot);
0670:                oto.getTimeouts().setTimeout(
0671:                        "ComponentOperator.WaitStateTimeout", 30000);
0672:
0673:                Node nodeClass = new Node(new SourcePackagesNode(projectName),
0674:                        pathToMain);
0675:                //nodeClass.select();
0676:
0677:                comOperator = new Operator.DefaultStringComparator(true, true);
0678:                oldOperator = (DefaultStringComparator) Operator
0679:                        .getDefaultStringComparator();
0680:                Operator.setDefaultStringComparator(comOperator);
0681:                new ProjectsTabOperator().tree().clearSelection();
0682:                nodeClass.performMenuActionNoBlock("Versioning|CVS|Export");
0683:                Operator.setDefaultStringComparator(oldOperator);
0684:                NbDialogOperator dialog = new NbDialogOperator("Export");
0685:                JTextFieldOperator tf = new JTextFieldOperator(dialog, 0);
0686:                String patchFile = "/tmp/patch" + System.currentTimeMillis()
0687:                        + ".patch";
0688:                File file = new File(patchFile);
0689:                //file.createNewFile();
0690:                tf.setText(file.getCanonicalFile().toString());
0691:                JButtonOperator btnExport = new JButtonOperator(dialog,
0692:                        "export");
0693:                //oo = OutputOperator.invoke();
0694:
0695:                oto = new OutputTabOperator(sessionCVSroot);
0696:                oto.clear();
0697:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0698:                        .toString()
0699:                        + File.separator + PROTOCOL_FOLDER,
0700:                        "diff/export_diff.in");
0701:                cvss = new PseudoCvsServer(in);
0702:                new Thread(cvss).start();
0703:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
0704:                        .getCvsRoot());
0705:                btnExport.push();
0706:                oto.waitText("Diff Patch finished");
0707:                cvss.stop();
0708:                Thread.sleep(1000);
0709:                //test file existence
0710:                assertTrue("Diff Patch file wasn't created!", file.isFile());
0711:                BufferedReader br = new BufferedReader(new FileReader(file));
0712:                String line = br.readLine();
0713:                boolean generated = false;
0714:                if (line != null) {
0715:                    generated = line
0716:                            .indexOf("# This patch file was generated by NetBeans IDE") != -1 ? true
0717:                            : false;
0718:                }
0719:
0720:                br.close();
0721:                assertTrue("Diff Patch file is empty!", generated);
0722:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0723:            }
0724:
0725:            public void testResolveConflicts() throws Exception {
0726:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
0727:                PseudoCvsServer cvss, cvss2, cvss3;
0728:                InputStream in, in2, in3;
0729:                //OutputOperator oo;
0730:                OutputTabOperator oto;
0731:                org.openide.nodes.Node nodeIDE;
0732:                String color, CVSroot;
0733:
0734:                oto = new OutputTabOperator(sessionCVSroot);
0735:                oto.getTimeouts().setTimeout(
0736:                        "ComponentOperator.WaitStateTimeout", 30000);
0737:                oto.clear();
0738:
0739:                Node nodeClass = new Node(new SourcePackagesNode(projectName),
0740:                        pathToMain);
0741:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0742:                        .toString()
0743:                        + File.separator + PROTOCOL_FOLDER,
0744:                        "diff/create_conflict.in");
0745:                cvss = new PseudoCvsServer(in);
0746:                new Thread(cvss).start();
0747:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
0748:                        .getCvsRoot());
0749:                nodeClass.performPopupActionNoBlock("CVS|Update");
0750:                NbDialogOperator dialog = new NbDialogOperator("Warning");
0751:                dialog.ok();
0752:                oto.waitText("cvs server: conflicts found in Main.java");
0753:                oto.waitText("Updating \"Main.java\" finished");
0754:                Thread.sleep(1000);
0755:                cvss.stop();
0756:
0757:                nodeClass = new Node(new SourcePackagesNode(projectName),
0758:                        pathToMain);
0759:                nodeIDE = (org.openide.nodes.Node) nodeClass.getOpenideNode();
0760:                color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
0761:                assertEquals("Wrong color for file in conflict",
0762:                        TestKit.CONFLICT_COLOR, color);
0763:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0764:            }
0765:
0766:            public void testCreateBranchForProject() throws Exception {
0767:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
0768:                PseudoCvsServer cvss, cvss2, cvss3;
0769:                InputStream in, in2, in3;
0770:                //OutputOperator oo;
0771:                OutputTabOperator oto;
0772:                org.openide.nodes.Node nodeIDE;
0773:                String color, CVSroot;
0774:
0775:                oto = new OutputTabOperator(sessionCVSroot);
0776:                oto.getTimeouts().setTimeout(
0777:                        "ComponentOperator.WaitStateTimeout", 30000);
0778:
0779:                Node rootNode = new ProjectsTabOperator()
0780:                        .getProjectRootNode(projectName);
0781:
0782:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0783:                        .toString()
0784:                        + File.separator + PROTOCOL_FOLDER,
0785:                        "create_new_branch_switch.in");
0786:                cvss = new PseudoCvsServer(in);
0787:                new Thread(cvss).start();
0788:                CVSroot = cvss.getCvsRoot();
0789:
0790:                in2 = TestKit.getStream(getDataDir().getCanonicalFile()
0791:                        .toString()
0792:                        + File.separator + PROTOCOL_FOLDER,
0793:                        "create_new_branch_switch_1.in");
0794:                cvss2 = new PseudoCvsServer(in2);
0795:                new Thread(cvss2).start();
0796:                //cvsRoot = cvsRoot + cvss2.getCvsRoot();
0797:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0798:                        CVSroot);
0799:
0800:                BranchOperator bo = BranchOperator.invoke(rootNode);
0801:                bo.setBranchName("MyNewBranch");
0802:                bo.checkSwitchToThisBranchAftewards(false);
0803:                bo.checkTagBeforeBranching(false);
0804:                oto = new OutputTabOperator(sessionCVSroot);
0805:                oto.getTimeouts().setTimeout(
0806:                        "ComponentOperator.WaitStateTimeout", 30000);
0807:                bo.branch();
0808:                Thread.sleep(1000);
0809:                //oo = OutputOperator.invoke();
0810:                //oto.waitText("Branching \"ForImport [Main]\" finished");
0811:                oto.waitText("Branch");
0812:                oto.waitText("ForImport");
0813:                oto.waitText("finished");
0814:                cvss.stop();
0815:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0816:            }
0817:
0818:            public void testSwitchProjectToBranch() throws Exception {
0819:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
0820:                PseudoCvsServer cvss;
0821:                InputStream in;
0822:                //OutputOperator oo;
0823:                OutputTabOperator oto;
0824:                org.openide.nodes.Node nodeIDE;
0825:                String color, cvsRoot;
0826:
0827:                oto = new OutputTabOperator(sessionCVSroot);
0828:                oto.getTimeouts().setTimeout(
0829:                        "ComponentOperator.WaitStateTimeout", 30000);
0830:
0831:                Node rootNode = new ProjectsTabOperator()
0832:                        .getProjectRootNode(projectName);
0833:
0834:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0835:                        .toString()
0836:                        + File.separator + PROTOCOL_FOLDER,
0837:                        "create_new_branch_switch_1.in");
0838:                cvss = new PseudoCvsServer(in);
0839:                new Thread(cvss).start();
0840:                cvsRoot = cvss.getCvsRoot();
0841:
0842:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
0843:                        cvsRoot);
0844:                oto = new OutputTabOperator(sessionCVSroot);
0845:                oto.getTimeouts().setTimeout(
0846:                        "ComponentOperator.WaitStateTimeout", 30000);
0847:                SwitchToBranchOperator sbo = SwitchToBranchOperator
0848:                        .invoke(rootNode);
0849:                sbo.switchToBranch();
0850:                sbo.setBranch("MyNewBranch");
0851:                sbo.pushSwitch();
0852:                Thread.sleep(1000);
0853:                //oo = OutputOperator.invoke();
0854:                oto.waitText(" to Branch finished");
0855:
0856:                cvss.stop();
0857:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0858:
0859:            }
0860:
0861:            public void testRevertModifications() throws Exception {
0862:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
0863:                PseudoCvsServer cvss;
0864:                InputStream in;
0865:                //OutputOperator oo;
0866:                OutputTabOperator oto;
0867:                org.openide.nodes.Node nodeIDE;
0868:                String color, cvsRoot;
0869:
0870:                //oo = OutputOperator.invoke();
0871:                oto = new OutputTabOperator(sessionCVSroot);
0872:                oto.getTimeouts().setTimeout(
0873:                        "ComponentOperator.WaitStateTimeout", 30000);
0874:                oto.clear();
0875:
0876:                //delete RevsionCache folder. It can contain checked out revisions
0877:                TestKit.deleteRecursively(cacheFolder);
0878:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0879:                        .toString()
0880:                        + File.separator + PROTOCOL_FOLDER,
0881:                        "revert_modifications.in");
0882:                cvss = new PseudoCvsServer(in);
0883:                new Thread(cvss).start();
0884:                Node nodeMain = new Node(new SourcePackagesNode("ForImport"),
0885:                        "forimport|Main.java");
0886:                nodeMain.performPopupActionNoBlock("CVS|Revert Modifications");
0887:                NbDialogOperator nbDialog = new NbDialogOperator(
0888:                        "Confirm overwrite");
0889:                JButtonOperator btnYes = new JButtonOperator(nbDialog, "Yes");
0890:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
0891:                        .getCvsRoot());
0892:                btnYes.push();
0893:                Thread.sleep(1000);
0894:                oto = new OutputTabOperator(sessionCVSroot);
0895:                oto.getTimeouts().setTimeout(
0896:                        "ComponentOperator.WaitStateTimeout", 30000);
0897:                oto.waitText("Reverting finished");
0898:                cvss.stop();
0899:
0900:                nodeIDE = (org.openide.nodes.Node) nodeMain.getOpenideNode();
0901:                assertNull("No color for node expected", nodeIDE
0902:                        .getHtmlDisplayName());
0903:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0904:            }
0905:
0906:            public void testShowAnnotations() throws Exception {
0907:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
0908:                PseudoCvsServer cvss, cvss2;
0909:                InputStream in, in2;
0910:                //OutputOperator oo;
0911:                OutputTabOperator oto;
0912:                org.openide.nodes.Node nodeIDE;
0913:                String color, cvsRoot;
0914:
0915:                TestKit.deleteRecursively(cacheFolder);
0916:
0917:                //oo = OutputOperator.invoke();
0918:                oto = new OutputTabOperator(sessionCVSroot);
0919:                oto.getTimeouts().setTimeout(
0920:                        "ComponentOperator.WaitStateTimeout", 30000);
0921:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0922:                        .toString()
0923:                        + File.separator + PROTOCOL_FOLDER,
0924:                        "show_annotation.in");
0925:                cvss = new PseudoCvsServer(in);
0926:                new Thread(cvss).start();
0927:
0928:                in2 = TestKit.getStream(getDataDir().getCanonicalFile()
0929:                        .toString()
0930:                        + File.separator + PROTOCOL_FOLDER,
0931:                        "show_annotation_1.in");
0932:                cvss2 = new PseudoCvsServer(in2);
0933:                new Thread(cvss2).start();
0934:
0935:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
0936:                        .getCvsRoot()
0937:                        + "," + cvss2.getCvsRoot());
0938:                Node nodeMain = new Node(new SourcePackagesNode("ForImport"),
0939:                        "forimport|Main.java");
0940:                oto = new OutputTabOperator(sessionCVSroot);
0941:                oto.getTimeouts().setTimeout(
0942:                        "ComponentOperator.WaitStateTimeout", 30000);
0943:                nodeMain.performPopupAction("CVS|Show Annotations");
0944:                Thread.sleep(1000);
0945:                oto.waitText("Loading Annotations finished");
0946:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
0947:                cvss.stop();
0948:                cvss2.stop();
0949:            }
0950:
0951:            public void testSearchHistory() throws Exception {
0952:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
0953:                PseudoCvsServer cvss, cvss2;
0954:                InputStream in, in2;
0955:                //OutputOperator oo;
0956:                OutputTabOperator oto;
0957:                org.openide.nodes.Node nodeIDE;
0958:                String color, cvsRoot;
0959:
0960:                TestKit.deleteRecursively(cacheFolder);
0961:
0962:                //oo = OutputOperator.invoke();
0963:                oto = new OutputTabOperator(sessionCVSroot);
0964:                oto.getTimeouts().setTimeout(
0965:                        "ComponentOperator.WaitStateTimeout", 30000);
0966:                in = TestKit
0967:                        .getStream(getDataDir().getCanonicalFile().toString()
0968:                                + File.separator + PROTOCOL_FOLDER,
0969:                                "search_history.in");
0970:                cvss = new PseudoCvsServer(in);
0971:                new Thread(cvss).start();
0972:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
0973:                        .getCvsRoot());
0974:                Node nodeMain = new Node(new SourcePackagesNode("ForImport"),
0975:                        "forimport|Main.java");
0976:                //nodeMain.performPopupAction("CVS|Search History...");
0977:                SearchHistoryOperator sho = SearchHistoryOperator
0978:                        .invoke(nodeMain);
0979:                oto.waitText("Searching History finished");
0980:                Thread.sleep(1000);
0981:                cvss.stop();
0982:
0983:                oto.clear();
0984:                in = TestKit.getStream(getDataDir().getCanonicalFile()
0985:                        .toString()
0986:                        + File.separator + PROTOCOL_FOLDER,
0987:                        "search_history_1.in");
0988:                cvss = new PseudoCvsServer(in);
0989:                new Thread(cvss).start();
0990:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
0991:                        .getCvsRoot());
0992:                sho.setUsername("test");
0993:                sho.setFrom("1.1");
0994:                sho.setTo("1.1");
0995:                sho.btSearch().push();
0996:                oto.waitText("Searching History started");
0997:                Thread.sleep(1000);
0998:                cvss.stop();
0999:                JListOperator list = sho.lstHistory();
1000:
1001:                ListModel model = list.getModel();
1002:                assertEquals("Wrong result count", 2, model.getSize());
1003:                assertTrue("Revision \"1.1\" is missing", model.getElementAt(1)
1004:                        .toString().indexOf("1.1") > 0);
1005:
1006:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
1007:            }
1008:
1009:            public void testVersioningButtons() throws Exception {
1010:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 3000);
1011:                VersioningOperator vo;
1012:                //OutputOperator oo;
1013:                OutputTabOperator oto;
1014:                InputStream in;
1015:                PseudoCvsServer cvss;
1016:                String CVSroot;
1017:                JTableOperator table;
1018:                org.openide.nodes.Node nodeIDE;
1019:                String color;
1020:
1021:                oto = new OutputTabOperator(sessionCVSroot);
1022:                oto.getTimeouts().setTimeout(
1023:                        "ComponentOperator.WaitStateTimeout", 30000);
1024:
1025:                //perform Show Changes action on Main.java file
1026:                Node nodeMain = new Node(new SourcePackagesNode(projectName),
1027:                        pathToMain);
1028:                //oo = OutputOperator.invoke();
1029:                //System.out.println(sessionCVSroot);
1030:                in = TestKit.getStream(getDataDir().getCanonicalFile()
1031:                        .toString()
1032:                        + File.separator + PROTOCOL_FOLDER,
1033:                        "versioning/show_changes_main.in");
1034:                cvss = new PseudoCvsServer(in);
1035:                new Thread(cvss).start();
1036:                CVSroot = cvss.getCvsRoot();
1037:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
1038:                        CVSroot);
1039:                nodeMain.performPopupAction("CVS|Show Changes");
1040:                Thread.sleep(1000);
1041:                vo = VersioningOperator.invoke();
1042:                table = vo.tabFiles();
1043:                //System.out.println(""+table);
1044:                oto.waitText("Refreshing CVS Status finished");
1045:                Thread.sleep(1000);
1046:                assertEquals("Table should be empty", 1, table.getRowCount());
1047:                assertEquals("File should be [Remotely Modified]",
1048:                        "Remotely Modified", table.getValueAt(0, 1).toString());
1049:                cvss.stop();
1050:                //System.out.println("Show Changes is ok");
1051:
1052:                //push refresh button
1053:                //oo = OutputOperator.invoke();
1054:                //oto = oo.getOutputTab(sessionCVSroot);
1055:                oto = new OutputTabOperator(sessionCVSroot);
1056:                oto.clear();
1057:                in = TestKit.getStream(getDataDir().getCanonicalFile()
1058:                        .toString()
1059:                        + File.separator + PROTOCOL_FOLDER,
1060:                        "versioning/refresh_main.in");
1061:                cvss = new PseudoCvsServer(in);
1062:                new Thread(cvss).start();
1063:                CVSroot = cvss.getCvsRoot();
1064:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
1065:                        CVSroot);
1066:                //vo = VersioningOperator.invoke();
1067:                vo.refresh();
1068:                oto.waitText("Refreshing CVS Status finished");
1069:                Thread.sleep(1000);
1070:                table = vo.tabFiles();
1071:                assertEquals("Table should be empty", 0, table.getRowCount());
1072:                cvss.stop();
1073:
1074:                //push Update all
1075:                //oo = OutputOperator.invoke();
1076:                oto = new OutputTabOperator(sessionCVSroot);
1077:                oto.clear();
1078:                in = TestKit.getStream(getDataDir().getCanonicalFile()
1079:                        .toString()
1080:                        + File.separator + PROTOCOL_FOLDER,
1081:                        "versioning/refresh_main.in");
1082:                cvss = new PseudoCvsServer(in);
1083:                new Thread(cvss).start();
1084:                CVSroot = cvss.getCvsRoot();
1085:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
1086:                        CVSroot);
1087:                //vo = VersioningOperator.invoke();
1088:                vo.update();
1089:                oto.waitText("Updating Sources finished");
1090:                Thread.sleep(1000);
1091:                cvss.stop();
1092:
1093:                //push commit button
1094:                vo.commit();
1095:                Thread.sleep(1000);
1096:
1097:                NbDialogOperator dialog = new NbDialogOperator("Comm");
1098:                JButtonOperator btnOk = new JButtonOperator(dialog, "OK");
1099:                btnOk.push();
1100:
1101:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
1102:            }
1103:
1104:            public void testRemoveFileGetBack() throws Exception {
1105:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
1106:                PseudoCvsServer cvss, cvss2, cvss3;
1107:                InputStream in, in2, in3;
1108:                //OutputOperator oo;
1109:                OutputTabOperator oto;
1110:                org.openide.nodes.Node nodeIDE;
1111:                String color, CVSroot;
1112:                VersioningOperator vo;
1113:                JTableOperator table;
1114:
1115:                oto = new OutputTabOperator(sessionCVSroot);
1116:                oto.getTimeouts().setTimeout(
1117:                        "ComponentOperator.WaitStateTimeout", 30000);
1118:
1119:                TestKit.deleteRecursively(cacheFolder);
1120:                Node nodeMain = new Node(new SourcePackagesNode(projectName),
1121:                        pathToMain);
1122:                in = TestKit.getStream(getDataDir().getCanonicalFile()
1123:                        .toString()
1124:                        + File.separator + PROTOCOL_FOLDER,
1125:                        "versioning/refresh_main.in");
1126:                cvss = new PseudoCvsServer(in);
1127:                new Thread(cvss).start();
1128:                CVSroot = cvss.getCvsRoot();
1129:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
1130:                        CVSroot);
1131:                nodeMain.performPopupAction("CVS|Show Changes");
1132:                Thread.sleep(1000);
1133:                vo = VersioningOperator.invoke();
1134:                cvss.stop();
1135:
1136:                nodeMain.performPopupActionNoBlock("Delete");
1137:                NbDialogOperator dialog = new NbDialogOperator(
1138:                        "Confirm Object Deletion");
1139:                dialog.yes();
1140:                Thread.sleep(1000);
1141:                table = vo.tabFiles();
1142:                assertEquals("Files should have been [Locally Deleted]",
1143:                        "Locally Deleted", table.getValueAt(0, 1).toString());
1144:                //node should disappear
1145:                TimeoutExpiredException tee = null;
1146:                try {
1147:                    nodeMain = new Node(new SourcePackagesNode(projectName),
1148:                            pathToMain);
1149:                } catch (Exception e) {
1150:                    tee = (TimeoutExpiredException) e;
1151:                }
1152:                assertNotNull(tee);
1153:
1154:                in = TestKit.getStream(getDataDir().getCanonicalFile()
1155:                        .toString()
1156:                        + File.separator + PROTOCOL_FOLDER,
1157:                        "revert_modifications.in");
1158:                cvss = new PseudoCvsServer(in);
1159:                new Thread(cvss).start();
1160:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
1161:                        .getCvsRoot());
1162:
1163:                //revert delete - get back the file.
1164:                new Thread(new Runnable() {
1165:                    public void run() {
1166:                        VersioningOperator vo = VersioningOperator.invoke();
1167:                        vo.performPopup("Main.java", "Revert Delete");
1168:                    }
1169:                }).start();
1170:                dialog = new NbDialogOperator("Confirm overwrite");
1171:                dialog.yes();
1172:                oto.waitText("Reverting finished");
1173:                Thread.sleep(1000);
1174:                cvss.stop();
1175:                //node should be back
1176:                nodeMain = new Node(new SourcePackagesNode(projectName),
1177:                        pathToMain);
1178:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
1179:            }
1180:
1181:            public void testRemoveFileCommit() throws Exception {
1182:                //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 18000);   
1183:                PseudoCvsServer cvss, cvss2, cvss3;
1184:                InputStream in, in2, in3;
1185:                //OutputOperator oo;
1186:                OutputTabOperator oto;
1187:                org.openide.nodes.Node nodeIDE;
1188:                String color, CVSroot;
1189:                VersioningOperator vo;
1190:                JTableOperator table;
1191:
1192:                oto = new OutputTabOperator(sessionCVSroot);
1193:                oto.getTimeouts().setTimeout(
1194:                        "ComponentOperator.WaitStateTimeout", 30000);
1195:
1196:                TestKit.deleteRecursively(cacheFolder);
1197:                Node nodeMain = new Node(new SourcePackagesNode(projectName),
1198:                        pathToMain);
1199:                in = TestKit.getStream(getDataDir().getCanonicalFile()
1200:                        .toString()
1201:                        + File.separator + PROTOCOL_FOLDER,
1202:                        "versioning/refresh_main.in");
1203:                cvss = new PseudoCvsServer(in);
1204:                new Thread(cvss).start();
1205:                CVSroot = cvss.getCvsRoot();
1206:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT",
1207:                        CVSroot);
1208:                nodeMain.performPopupAction("CVS|Show Changes");
1209:                Thread.sleep(1000);
1210:                vo = VersioningOperator.invoke();
1211:                cvss.stop();
1212:
1213:                //delete file again and commit deletion
1214:                nodeMain = new Node(new SourcePackagesNode(projectName),
1215:                        pathToMain);
1216:                nodeMain.performPopupActionNoBlock("Delete");
1217:                NbDialogOperator dialog = new NbDialogOperator(
1218:                        "Confirm Object Deletion");
1219:                dialog.yes();
1220:                Thread.sleep(1000);
1221:                table = vo.tabFiles();
1222:                assertEquals("Files should have been [Locally Deleted]",
1223:                        "Locally Deleted", table.getValueAt(0, 1).toString());
1224:
1225:                TimeoutExpiredException tee = null;
1226:                try {
1227:                    nodeMain = new Node(new SourcePackagesNode(projectName),
1228:                            pathToMain);
1229:                } catch (Exception e) {
1230:                    tee = (TimeoutExpiredException) e;
1231:                }
1232:                assertNotNull(tee);
1233:
1234:                in = TestKit.getStream(getDataDir().getCanonicalFile()
1235:                        .toString()
1236:                        + File.separator + PROTOCOL_FOLDER,
1237:                        "commit_locally_deleted_main.in");
1238:                cvss = new PseudoCvsServer(in);
1239:                new Thread(cvss).start();
1240:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss
1241:                        .getCvsRoot());
1242:
1243:                //revert delete - get back the file.
1244:                CommitOperator co = vo.commit();
1245:                table = co.tabFiles();
1246:                assertEquals("There should be one file only", 1, table
1247:                        .getRowCount());
1248:                assertEquals("There should Main.java file", "Main.java", table
1249:                        .getValueAt(0, 0));
1250:                assertEquals("File Main.java should be [Locally Deleted]",
1251:                        "Locally Deleted", table.getValueAt(0, 1));
1252:                co.commit();
1253:
1254:                Thread.sleep(1000);
1255:                cvss.stop();
1256:                oto.waitText("Committing finished");
1257:
1258:                tee = null;
1259:                try {
1260:                    nodeMain = new Node(new SourcePackagesNode(projectName),
1261:                            pathToMain);
1262:                } catch (Exception e) {
1263:                    tee = (TimeoutExpiredException) e;
1264:                }
1265:                assertNotNull(tee);
1266:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
1267:            }
1268:
1269:            public void removeAllData() {
1270:                TestKit.removeAllData(projectName);
1271:                System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
1272:            }
1273:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.