KickJava   Java API By Example, From Geeks To Geeks.

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


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

19
20 package org.netbeans.test.cvsmodule;
21
22 import java.io.File JavaDoc;
23 import java.io.InputStream JavaDoc;
24 import junit.textui.TestRunner;
25 import org.netbeans.jellytools.JellyTestCase;
26 import org.netbeans.jellytools.NbDialogOperator;
27 import org.netbeans.jellytools.OutputOperator;
28 import org.netbeans.jellytools.OutputTabOperator;
29 import org.netbeans.jellytools.ProjectsTabOperator;
30 import org.netbeans.jellytools.modules.javacvs.BrowseRepositoryFolderOperator;
31 import org.netbeans.jellytools.modules.javacvs.CVSRootStepOperator;
32 import org.netbeans.jellytools.modules.javacvs.EditCVSRootOperator;
33 import org.netbeans.jellytools.modules.javacvs.FolderToImportStepOperator;
34 import org.netbeans.jellytools.modules.javacvs.ImportWizardOperator;
35 import org.netbeans.jellytools.nodes.Node;
36 import org.netbeans.jemmy.JemmyProperties;
37 import org.netbeans.jemmy.TimeoutExpiredException;
38 import org.netbeans.jemmy.operators.JButtonOperator;
39 import org.netbeans.jemmy.operators.JCheckBoxOperator;
40 import org.netbeans.jemmy.operators.JComboBoxOperator;
41 import org.netbeans.jemmy.operators.JFileChooserOperator;
42 import org.netbeans.jemmy.operators.JLabelOperator;
43 import org.netbeans.jemmy.operators.JPasswordFieldOperator;
44 import org.netbeans.jemmy.operators.JProgressBarOperator;
45 import org.netbeans.jemmy.operators.JRadioButtonOperator;
46 import org.netbeans.jemmy.operators.JTextFieldOperator;
47 import org.netbeans.jemmy.operators.Operator;
48 import org.netbeans.jemmy.operators.Operator.DefaultStringComparator;
49 import org.netbeans.junit.NbTestSuite;
50 import org.netbeans.junit.ide.ProjectSupport;
51 /**
52  *
53  * @author peter
54  */

55 public class ImportWizardTest extends JellyTestCase {
56     
57     String JavaDoc os_name;
58     File JavaDoc file;
59     static String JavaDoc sessionCVSroot;
60     final String JavaDoc projectName = "ForImport";
61     final String JavaDoc pathToMain = "forimport|Main.java";
62     final String JavaDoc PROTOCOL_FOLDER = "protocol";
63     Operator.DefaultStringComparator comOperator;
64     Operator.DefaultStringComparator oldOperator;
65     
66     /**
67      * @param args the command line arguments
68      */

69     public static void main(String JavaDoc[] args) {
70         // TODO code application logic here
71

72         TestRunner.run(suite());
73     }
74     
75     public static NbTestSuite suite() {
76         
77         NbTestSuite suite = new NbTestSuite();
78         suite.addTest(new ImportWizardTest("prepareProject"));
79         suite.addTest(new ImportWizardTest("testImportWizardPserverUI"));
80         suite.addTest(new ImportWizardTest("testImportWizardLocalUI"));
81         suite.addTest(new ImportWizardTest("testImportWizardForkUI"));
82         suite.addTest(new ImportWizardTest("testImportWizardExtUI"));
83         suite.addTest(new ImportWizardTest("testImportWizardExt"));
84         suite.addTest(new ImportWizardTest("testImportWizardLocal"));
85         suite.addTest(new ImportWizardTest("testImportWizardFork"));
86         suite.addTest(new ImportWizardTest("testImportWizardPserver"));
87         suite.addTest(new ImportWizardTest("testImportWizardLoginSuccess"));
88         suite.addTest(new ImportWizardTest("testImportWizardSecondStepUI"));
89         suite.addTest(new ImportWizardTest("testImportWizardFinish"));
90         suite.addTest(new ImportWizardTest("removeAllData"));
91         //debug
92
//suite.addTest(new ImportWizardTest("prepareProject"));
93

94         //suite.addTest(new ImportWizardTest("removeAllData"));
95
return suite;
96     }
97     protected void setUp() throws Exception JavaDoc {
98         
99         os_name = System.getProperty("os.name");
100         //System.out.println(os_name);
101
System.out.println("### "+getName()+" ###");
102         
103     }
104     
105     protected boolean isUnix() {
106         boolean unix = false;
107         if (os_name.indexOf("Windows") == -1) {
108             unix = true;
109         }
110         return unix;
111     }
112     
113     /** Creates a new instance of ImportWizardTest */
114     public ImportWizardTest(String JavaDoc name) {
115         super(name);
116     }
117     
118     public void testImportWizardPserverUI() {
119         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
120
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
121
comOperator = new Operator.DefaultStringComparator(true, true);
122         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
123         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
124         Operator.setDefaultStringComparator(comOperator);
125         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
126         Operator.setDefaultStringComparator(oldOperator);
127         
128         CVSRootStepOperator crso = new CVSRootStepOperator();
129         crso.setCVSRoot(":local:/cvs");
130         //Invalid CVS Root
131
crso.setCVSRoot(":pserver:test");
132         try {
133             JLabelOperator inv = new JLabelOperator(crso, "Invalid CVS Root");
134         } catch (TimeoutExpiredException e) {
135             throw e;
136         }
137         
138         crso.setCVSRoot(":pserver:test@localhost:2401/cvs");
139         //start test UI
140

141         //combobox
142
try {
143             JComboBoxOperator combo = new JComboBoxOperator(crso);
144             JPasswordFieldOperator passwd = new JPasswordFieldOperator(crso);
145             JButtonOperator btnEdit = new JButtonOperator(crso, "Edit...");
146             JButtonOperator btnProxy = new JButtonOperator(crso, "Proxy Configuration...");
147             JButtonOperator btnBack = new JButtonOperator(crso, "< Back");
148             JButtonOperator btnNext = new JButtonOperator(crso, "Next >");
149             JButtonOperator btnFinish = new JButtonOperator(crso, "Finish");
150             JButtonOperator btnCancel = new JButtonOperator(crso, "Cancel");
151             JButtonOperator btnHelp = new JButtonOperator(crso, "Help");
152         } catch (TimeoutExpiredException e) {
153             throw e;
154         }
155         //end test UI
156
iwo.cancel();
157     }
158     
159     public void testImportWizardLocalUI() {
160         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
161
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
162
comOperator = new Operator.DefaultStringComparator(true, true);
163         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
164         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
165         Operator.setDefaultStringComparator(comOperator);
166         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
167         Operator.setDefaultStringComparator(oldOperator);
168         CVSRootStepOperator crso = new CVSRootStepOperator();
169         crso.setCVSRoot(":local:/cvs");
170         //Invalid CVS Root
171
crso.setCVSRoot(":loca:");
172         try {
173             JLabelOperator inv = new JLabelOperator(crso, "Only :pserver:, :local:, :ext: and :fork: connection methods supported");
174         } catch (TimeoutExpiredException e) {
175             throw e;
176         }
177         crso.setCVSRoot(":local:/cvs");
178         Exception JavaDoc ex;
179         //start test UI
180
//combobox
181
try {
182             JComboBoxOperator combo = new JComboBoxOperator(crso);
183             //JPasswordFieldOperator passwd = new JPasswordFieldOperator(crso);
184
JButtonOperator btnEdit = new JButtonOperator(crso, "Edit...");
185             JButtonOperator btnBack = new JButtonOperator(crso, "< Back");
186             JButtonOperator btnNext = new JButtonOperator(crso, "Next >");
187             JButtonOperator btnFinish = new JButtonOperator(crso, "Finish");
188             JButtonOperator btnCancel = new JButtonOperator(crso, "Cancel");
189             JButtonOperator btnHelp = new JButtonOperator(crso, "Help");
190         } catch (TimeoutExpiredException e) {
191             throw e;
192         }
193         //end test UI
194

195         iwo.cancel();
196     }
197     
198     public void testImportWizardForkUI() {
199         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
200
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
201
comOperator = new Operator.DefaultStringComparator(true, true);
202         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
203         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
204         Operator.setDefaultStringComparator(comOperator);
205         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
206         Operator.setDefaultStringComparator(oldOperator);
207         CVSRootStepOperator crso = new CVSRootStepOperator();
208         crso.setCVSRoot(":fork:/cvs");
209         //Invalid CVS Root
210
crso.setCVSRoot(":for:");
211         try {
212             JLabelOperator inv = new JLabelOperator(crso, "Only :pserver:, :local:, :ext: and :fork: connection methods supported");
213             assertNotNull(inv);
214         } catch (TimeoutExpiredException e) {
215             throw e;
216         }
217         
218         crso.setCVSRoot(":fork:/cvs");
219         //start test UI
220

221         try {
222             JComboBoxOperator combo = new JComboBoxOperator(crso);
223             //JPasswordFieldOperator passwd = new JPasswordFieldOperator(crso);
224
JButtonOperator btnEdit = new JButtonOperator(crso, "Edit...");
225             JButtonOperator btnBack = new JButtonOperator(crso, "< Back");
226             JButtonOperator btnNext = new JButtonOperator(crso, "Next >");
227             JButtonOperator btnFinish = new JButtonOperator(crso, "Finish");
228             JButtonOperator btnCancel = new JButtonOperator(crso, "Cancel");
229             JButtonOperator btnHelp = new JButtonOperator(crso, "Help");
230         } catch (TimeoutExpiredException e) {
231             throw e;
232         }
233         //end test UI
234

235         iwo.cancel();
236     }
237     
238     public void testImportWizardExtUI() {
239         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
240
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
241
comOperator = new Operator.DefaultStringComparator(true, true);
242         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
243         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
244         Operator.setDefaultStringComparator(comOperator);
245         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
246         Operator.setDefaultStringComparator(oldOperator);
247         CVSRootStepOperator crso = new CVSRootStepOperator();
248         crso.setCVSRoot(":ext:test@localhost:2401/cvs");
249         //Invalid CVS Root
250
crso.setCVSRoot(":ext:test");
251         try {
252             JLabelOperator inv = new JLabelOperator(crso, "Invalid CVS Root");
253         } catch (TimeoutExpiredException e) {
254             throw e;
255         }
256         
257         crso.setCVSRoot(":ext:test@localhost:2401/cvs");
258         //start test UI
259
try {
260             JComboBoxOperator combo = new JComboBoxOperator(crso);
261             JPasswordFieldOperator passwd = new JPasswordFieldOperator(crso);
262             JButtonOperator btnEdit = new JButtonOperator(crso, "Edit...");
263             JButtonOperator btnProxy = new JButtonOperator(crso, "Proxy Configuration...");
264             JRadioButtonOperator internal = new JRadioButtonOperator(crso, "Use Internal SSH");
265             JRadioButtonOperator external = new JRadioButtonOperator(crso, "Use External Shell");
266             JCheckBoxOperator remeber = new JCheckBoxOperator(crso, "Remember Password");
267             JTextFieldOperator sshCommand = new JTextFieldOperator(crso);
268             JButtonOperator btnBack = new JButtonOperator(crso, "< Back");
269             JButtonOperator btnNext = new JButtonOperator(crso, "Next >");
270             JButtonOperator btnFinish = new JButtonOperator(crso, "Finish");
271             JButtonOperator btnCancel = new JButtonOperator(crso, "Cancel");
272             JButtonOperator btnHelp = new JButtonOperator(crso, "Help");
273         } catch (TimeoutExpiredException e) {
274             throw e;
275         }
276         //end test UI
277
System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
278         iwo.cancel();
279     }
280     
281     public void testImportWizardLoginSuccess() throws Exception JavaDoc {
282         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
283
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
284
comOperator = new Operator.DefaultStringComparator(true, true);
285         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
286         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
287         Operator.setDefaultStringComparator(comOperator);
288         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
289         Operator.setDefaultStringComparator(oldOperator);
290         final CVSRootStepOperator crso = new CVSRootStepOperator();
291         crso.setCVSRoot(":pserver:test@localhost:/cvs");
292         //crso.setPassword("test");
293

294         //prepare stream for successful authentification and run PseudoCVSServer
295
InputStream JavaDoc in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "authorized.in");
296         if (in == null) {
297             System.err.println(getClass().getProtectionDomain().getCodeSource().getLocation().toExternalForm());
298             in.markSupported();
299         }
300         PseudoCvsServer cvss = new PseudoCvsServer(in);
301         new Thread JavaDoc(cvss).start();
302         cvss.ignoreProbe();
303         crso.setCVSRoot(cvss.getCvsRoot());
304         
305         crso.next();
306               
307         try {
308            JProgressBarOperator progress = new JProgressBarOperator(crso);
309            JButtonOperator btnStop = new JButtonOperator(crso);
310         } catch (TimeoutExpiredException e) {
311             throw e;
312         }
313         
314         //Wizard proceeded to 2nd step.
315
FolderToImportStepOperator folderToImportOper = new FolderToImportStepOperator();
316         cvss.stop();
317         in.close();
318         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
319         iwo.cancel();
320     }
321     
322     public void testImportWizardExt() {
323         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
324
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
325
comOperator = new Operator.DefaultStringComparator(true, true);
326         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
327         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
328         Operator.setDefaultStringComparator(comOperator);
329         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
330         Operator.setDefaultStringComparator(oldOperator);
331         CVSRootStepOperator crso = new CVSRootStepOperator();
332         crso.setCVSRoot(":ext:test@localhost:2401/cvs");
333         crso.rbUseInternalSSH().push();
334         crso.setPassword("test");
335         crso.cbRememberPassword().push();
336         crso.cbRememberPassword().push();
337         crso.rbUseExternalShell().push();
338         crso.setSSHCommand("plink.exe -l user -i private_key.ppk");
339         EditCVSRootOperator editOperator = crso.edit();
340         assertEquals("Wrong access method in Edit CVSRoot dialog", "ext", editOperator.getAccessMethod());
341         assertEquals("Wrong username Edit CVSRoot dialog", "test", editOperator.getUser());
342         assertEquals("Wrong hostname in Edit CVSRoot dialog", "localhost", editOperator.getHost());
343         assertEquals("Wrong port Edit CVSRoot dialog", "2401", editOperator.getPort());
344         assertEquals("Wrong repository path Edit CVSRoot dialog", "/cvs", editOperator.getRepositoryPath());
345         
346         //change values in EditCVSRoot dialog but cancel it
347
editOperator.selectAccessMethod(editOperator.ITEM_EXT);
348         editOperator.setRepositoryPath("/cvs/repo");
349         editOperator.setHost("127.0.0.1");
350         editOperator.setUser("user");
351         editOperator.setPort("8080");
352         editOperator.cancel();
353         assertEquals("Values are propagated, but Cancel was push", ":ext:test@localhost:2401/cvs", crso.getCVSRoot());
354         
355         //change values in EditCVSRoot dialog
356
editOperator = crso.edit();
357         editOperator.selectAccessMethod(editOperator.ITEM_EXT);
358         editOperator.setRepositoryPath("/cvs/repo");
359         editOperator.setHost("127.0.0.1");
360         editOperator.setUser("user");
361         editOperator.setPort("8080");
362         editOperator.ok();
363         assertEquals("Values are not propagated correctly", ":ext:user@127.0.0.1:8080/cvs/repo", crso.getCVSRoot());
364         crso.cancel();
365     }
366     
367     public void testImportWizardLocal() {
368         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
369
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
370
comOperator = new Operator.DefaultStringComparator(true, true);
371         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
372         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
373         Operator.setDefaultStringComparator(comOperator);
374         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
375         Operator.setDefaultStringComparator(oldOperator);
376         CVSRootStepOperator crso = new CVSRootStepOperator();
377         crso.setCVSRoot(":local:/cvs");
378         
379         EditCVSRootOperator editOperator = crso.edit();
380         assertEquals("Wrong access method in Edit CVSRoot dialog", "local", editOperator.getAccessMethod());
381         assertEquals("Wrong repository path in Edit CVSRoot dialog", "/cvs", editOperator.getRepositoryPath());
382         
383         //change values in EditCVSRoot dialog but cancel it
384
editOperator.setRepositoryPath("/cvs/repo");
385         editOperator.cancel();
386         assertEquals("Values are propagated, but Cancel was push", ":local:/cvs", crso.getCVSRoot());
387         
388         //change values in EditCVSRoot dialog
389
editOperator = crso.edit();
390         editOperator.setRepositoryPath("/cvs/repo");
391         editOperator.ok();
392         assertEquals("Values are propagated, but Cancel was push", ":local:/cvs/repo", crso.getCVSRoot());
393         crso.cancel();
394     }
395     
396     public void testImportWizardFork() {
397         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
398
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
399
comOperator = new Operator.DefaultStringComparator(true, true);
400         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
401         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
402         Operator.setDefaultStringComparator(comOperator);
403         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
404         Operator.setDefaultStringComparator(oldOperator);
405         CVSRootStepOperator crso = new CVSRootStepOperator();
406         crso.setCVSRoot(":fork:/cvs");
407         
408         EditCVSRootOperator editOperator = crso.edit();
409         assertEquals("Wrong access method in Edit CVSRoot dialog", "fork", editOperator.getAccessMethod());
410         assertEquals("Wrong repository path in Edit CVSRoot dialog", "/cvs", editOperator.getRepositoryPath());
411         
412         //change values in EditCVSRoot dialog but cancel it
413
editOperator.setRepositoryPath("/cvs/repo");
414         editOperator.cancel();
415         assertEquals("Values are propagated, but Cancel was push", ":fork:/cvs", crso.getCVSRoot());
416         
417         //change values in EditCVSRoot dialog
418
editOperator = crso.edit();
419         editOperator.setRepositoryPath("/cvs/repo");
420         editOperator.ok();
421         assertEquals("Values are propagated, but Cancel was push", ":fork:/cvs/repo", crso.getCVSRoot());
422         crso.cancel();
423     }
424     
425     public void testImportWizardPserver() {
426         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
427
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
428
comOperator = new Operator.DefaultStringComparator(true, true);
429         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
430         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
431         Operator.setDefaultStringComparator(comOperator);
432         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
433         Operator.setDefaultStringComparator(oldOperator);
434         CVSRootStepOperator crso = new CVSRootStepOperator();
435         
436         crso.setCVSRoot(":pserver:test@localhost:2401/cvs");
437         crso.setPassword("test");
438         
439         //crso.cbRememberPassword().setSelected(true);
440
//crso.cbRememberPassword().setSelected(false);
441
EditCVSRootOperator editOperator = crso.edit();
442         assertEquals("Wrong access method in Edit CVSRoot dialog", "pserver", editOperator.getAccessMethod());
443         assertEquals("Wrong username Edit CVSRoot dialog", "test", editOperator.getUser());
444         assertEquals("Wrong hostname in Edit CVSRoot dialog", "localhost", editOperator.getHost());
445         assertEquals("Wrong port Edit CVSRoot dialog", "2401", editOperator.getPort());
446         assertEquals("Wrong repository path Edit CVSRoot dialog", "/cvs", editOperator.getRepositoryPath());
447         
448         //change values in EditCVSRoot dialog but cancel it
449
editOperator.selectAccessMethod(editOperator.ITEM_PSERVER);
450         editOperator.setRepositoryPath("/cvs/repo");
451         editOperator.setHost("127.0.0.1");
452         editOperator.setUser("user");
453         editOperator.setPort("8080");
454         editOperator.cancel();
455         assertEquals("Values are propagated, but Cancel was push", ":pserver:test@localhost:2401/cvs", crso.getCVSRoot());
456         
457         //change values in EditCVSRoot dialog
458
editOperator = crso.edit();
459         editOperator.selectAccessMethod(editOperator.ITEM_PSERVER);
460         editOperator.setRepositoryPath("/cvs/repo");
461         editOperator.setHost("127.0.0.1");
462         editOperator.setUser("user");
463         editOperator.setPort("8080");
464         editOperator.ok();
465         assertEquals("Values are not propagated correctly", ":pserver:user@127.0.0.1:8080/cvs/repo", crso.getCVSRoot());
466         crso.cancel();
467         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
468     }
469     
470     public void testImportWizardSecondStepUI() throws Exception JavaDoc {
471         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
472
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
473
//JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 3000);
474
comOperator = new Operator.DefaultStringComparator(true, true);
475         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
476         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
477         Operator.setDefaultStringComparator(comOperator);
478         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
479         Operator.setDefaultStringComparator(oldOperator);
480         final CVSRootStepOperator crso = new CVSRootStepOperator();
481         crso.setCVSRoot(":pserver:test@localhost:/cvs");
482         //crso.setPassword("test");
483

484         //prepare stream for successful authentification and run PseudoCVSServer
485
InputStream JavaDoc in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "authorized.in");
486         if (in == null) {
487             System.err.println(getClass().getProtectionDomain().getCodeSource().getLocation().toExternalForm());
488             in.markSupported();
489         }
490         PseudoCvsServer cvss = new PseudoCvsServer(in);
491         new Thread JavaDoc(cvss).start();
492         cvss.ignoreProbe();
493         crso.setCVSRoot(cvss.getCvsRoot());
494         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", cvss.getCvsRoot());
495         crso.next();
496               
497         try {
498            JProgressBarOperator progress = new JProgressBarOperator(crso);
499            JButtonOperator btnStop = new JButtonOperator(crso);
500         } catch (TimeoutExpiredException e) {
501             throw e;
502         }
503         
504         //Wizard proceeded to 2nd step.
505

506         FolderToImportStepOperator folderToImportOper = new FolderToImportStepOperator();
507         cvss.stop();
508         in.close();
509         folderToImportOper.setFolderToImport(getWorkDirPath());
510         JFileChooserOperator browseFolder = folderToImportOper.browseFolderToImport();
511         assertEquals("Directory set in wizard not propagated to file chooser:", getWorkDir().getAbsolutePath(), browseFolder.getCurrentDirectory().getAbsolutePath()); // NOI18N
512
browseFolder.cancel();
513         folderToImportOper.setImportMessage("Import message"); //NOI18N
514

515         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "repository_browsing.in");
516         cvss = new PseudoCvsServer(in);
517         new Thread JavaDoc(cvss).start();
518         String JavaDoc CVSroot = cvss.getCvsRoot();
519         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
520         
521         folderToImportOper.setRepositoryFolder("folder");
522         BrowseRepositoryFolderOperator browseRepositoryOper = folderToImportOper.browseRepositoryFolder();
523         browseRepositoryOper.selectFolder(""); // NOI18N
524
browseRepositoryOper.ok();
525         folderToImportOper.checkCheckoutAfterImport(false);
526         iwo.cancel();
527         cvss.stop();
528         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
529     }
530     
531     public void testImportWizardFinish() throws Exception JavaDoc {
532         //JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 36000);
533
//JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 36000);
534
String JavaDoc CVSroot;
535         PseudoCvsServer cvss;
536         OutputOperator oo = OutputOperator.invoke();
537         TestKit.unversionProject(file, projectName);
538         
539         comOperator = new Operator.DefaultStringComparator(true, true);
540         oldOperator = (DefaultStringComparator) Operator.getDefaultStringComparator();
541         Node node = new ProjectsTabOperator().getProjectRootNode(projectName);
542         Operator.setDefaultStringComparator(comOperator);
543         ImportWizardOperator iwo = ImportWizardOperator.invoke(node);
544         Operator.setDefaultStringComparator(oldOperator);
545         CVSRootStepOperator crso = new CVSRootStepOperator();
546         JComboBoxOperator combo = new JComboBoxOperator(crso, 0);
547         crso.setCVSRoot(":pserver:test@localhost:/cvs");
548         //crso.setPassword("test");
549

550         //prepare stream for successful authentification and run PseudoCVSServer
551
InputStream JavaDoc in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "authorized.in");
552         if (in == null) {
553             System.err.println(getClass().getProtectionDomain().getCodeSource().getLocation().toExternalForm());
554             in.markSupported();
555         }
556         cvss = new PseudoCvsServer(in);
557         new Thread JavaDoc(cvss).start();
558         cvss.ignoreProbe();
559         CVSroot = cvss.getCvsRoot();
560         sessionCVSroot = CVSroot;
561         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
562         crso.setCVSRoot(CVSroot);
563         crso.next();
564               
565         try {
566            JProgressBarOperator progress = new JProgressBarOperator(crso);
567            JButtonOperator btnStop = new JButtonOperator(crso);
568         } catch (TimeoutExpiredException e) {
569             throw e;
570         }
571         
572         //Wizard proceeded to 2nd step.
573

574         FolderToImportStepOperator folderToImportOper = new FolderToImportStepOperator();
575         cvss.stop();
576         in.close();
577         folderToImportOper.setImportMessage("initial import");
578         folderToImportOper.checkCheckoutAfterImport(false);
579         in = TestKit.getStream(getDataDir().getCanonicalFile().toString() + File.separator + PROTOCOL_FOLDER, "import_finish.in");
580         cvss = new PseudoCvsServer(in);
581         new Thread JavaDoc(cvss).start();
582         CVSroot = cvss.getCvsRoot();
583         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", CVSroot);
584         //cvss.ignoreProbe();
585

586         //crso.setCVSRoot(CVSroot);/
587
folderToImportOper.finish();
588         
589         
590         //System.out.println(CVSroot);
591
OutputTabOperator oto = new OutputTabOperator(sessionCVSroot);
592         oto.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 30000);
593         oto.waitText("Importing finished");
594         cvss.stop();
595         in.close();
596         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
597         //TestKit.removeAllData(projectName, file);
598
}
599     
600     public void prepareProject() throws Exception JavaDoc {
601         TestKit.closeProject(projectName);
602         file = TestKit.prepareProject("General", "Java Application", projectName, "Main.java");
603     }
604     
605     public void removeAllData() throws Exception JavaDoc {
606         TestKit.closeProject(projectName);
607         System.setProperty("netbeans.t9y.cvs.connection.CVSROOT", "");
608     }
609 }
610
Popular Tags