KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > gui > httpserver > Module


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.gui.httpserver;
21
22 import org.netbeans.junit.NbTestSuite;
23 import org.netbeans.junit.NbTestCase;
24 import org.netbeans.modules.httpserver.*;
25
26 import java.awt.Robot JavaDoc;
27 import java.awt.event.*;
28 import java.io.*;
29 import java.net.*;
30 import javax.swing.*;
31
32 import org.openide.awt.*;
33
34 import org.netbeans.jellytools.*;
35 import org.netbeans.jellytools.nodes.*;
36 import org.netbeans.jellytools.actions.*;
37 import org.netbeans.jellytools.properties.*;
38 import org.netbeans.jemmy.*;
39 import org.netbeans.jemmy.operators.*;
40 import org.netbeans.junit.AssertionFailedErrorException;
41 import org.netbeans.junit.NbTest;
42
43 public class Module extends JellyTestCase {
44
45     private String JavaDoc workDir=null;
46     private String JavaDoc value=null;
47     private String JavaDoc old_value=null;
48     private ExplorerOperator explorer=null;
49     private static boolean mwm=true;
50     private NbDialogOperator dop=null;
51     private OptionsOperator optionsOper=null;
52     private PropertySheetTabOperator psto=null;
53     private String JavaDoc delim="|"; // NOI18N
54
private String JavaDoc failMessage="test failed"; // NOI18N
55

56         private static String JavaDoc originalPort = "8082";
57         
58         private HttpServerSettings serverSettings = new HttpServerSettings();
59
60     public Module(String JavaDoc testName) {
61         super(testName);
62     }
63     
64     public static NbTestSuite suite() {
65         NbTestSuite suite = new NbTestSuite("test_temp");
66         suite.addTest(new Module("test_1_1"));
67         /*
68         suite.addTest(new Module("test_1_5"));
69         suite.addTest(new Module("test_2_1"));
70         suite.addTest(new Module("test_2_2"));
71         suite.addTest(new Module("test_3_1"));
72         suite.addTest(new Module("test_3_2"));
73         */

74         suite.addTest(new Module("test_4_1_1"));
75         suite.addTest(new Module("test_4_2_1"));
76         suite.addTest(new Module("test_4_2_2"));
77         suite.addTest(new Module("test_4_2_4"));
78         suite.addTest(new Module("test_4_2_5"));
79         suite.addTest(new Module("test_4_2_6"));
80         suite.addTest(new Module("test_4_2_7"));
81         
82         
83         suite.addTest(new Module("test_4_3_1"));
84         suite.addTest(new Module("test_4_3_2"));
85         /*
86         //suite.addTest(new Module("test_4_5_1"));
87         //suite.addTest(new Module("test_4_5_2"));
88         //suite.addTest(new Module("test_4_5_3"));
89         suite.addTest(new Module("test_4_5_4"));
90         //suite.addTest(new Module("test_4_6_1"));
91         //suite.addTest(new Module("test_4_6_2"));
92         //suite.addTest(new Module("test_4_6_3"));
93         //suite.addTest(new Module("test_4_6_4"));
94         suite.addTest(new Module("test_4_6_5"));
95         //suite.addTest(new Module("test_4_7_1"));
96         //suite.addTest(new Module("test_4_7_2"));
97         //suite.addTest(new Module("test_4_7_3"));
98         //suite.addTest(new Module("test_4_7_4"));
99         suite.addTest(new Module("test_4_7_5"));
100          */

101         
102         suite.addTest(new Module("test_4_8_01"));
103         suite.addTest(new Module("test_4_8_02"));
104         suite.addTest(new Module("test_4_8_03"));
105         suite.addTest(new Module("test_4_8_04"));
106         suite.addTest(new Module("test_4_8_05"));
107         suite.addTest(new Module("test_4_8_06"));
108         suite.addTest(new Module("test_4_8_07"));
109         suite.addTest(new Module("test_4_8_08"));
110         
111         /*
112         suite.addTest(new Module("test_4_8_09"));
113         suite.addTest(new Module("test_4_8_10"));
114         suite.addTest(new Module("test_4_8_11"));
115         suite.addTest(new Module("test_4_8_12"));
116         suite.addTest(new Module("test_4_8_13"));
117         suite.addTest(new Module("test_4_8_14"));
118         suite.addTest(new Module("test_4_8_15"));
119         suite.addTest(new Module("test_4_8_16"));
120         suite.addTest(new Module("test_4_8_17"));
121         suite.addTest(new Module("test_4_8_18"));
122         suite.addTest(new Module("test_4_8_19"));
123         suite.addTest(new Module("test_4_8_20"));
124         suite.addTest(new Module("test_4_8_21"));
125         suite.addTest(new Module("test_4_8_22"));
126         suite.addTest(new Module("test_4_8_23"));
127         suite.addTest(new Module("test_4_8_24"));
128         */

129         
130         suite.addTest(new Module("test_4_9_1"));
131         suite.addTest(new Module("test_4_9_2"));
132         suite.addTest(new Module("test_4_9_3"));
133         
134         return suite;
135     }
136
137     /** Use for execution inside IDE */
138     public static void main(java.lang.String JavaDoc[] args) {
139         //junit.textui.TestRunner.run(new NbTestSuite(Module.class));
140
junit.textui.TestRunner.run(suite());
141         
142     }
143
144     public void setUp() {
145         System.out.println("#"+getName());
146     }
147
148     private void waitFor(int ms) {
149 // On W2k k=1, on Solaris/Linux it's better to set k=2-3
150
int k=1;
151         new EventTool().waitNoEvent(ms*k);
152     }
153
154     private AssertionFailedErrorException checkDialog(String JavaDoc name) {
155
156     try {
157         dop=new NbDialogOperator(name);
158     } catch(Exception JavaDoc ex) {
159         return new AssertionFailedErrorException("No '"+name+"' dialog appears",ex);
160     }
161     dop.close();
162     return null;
163     }
164
165     private void switchToHTTPServerNode() {
166
167         RuntimeTabOperator runtime = RuntimeTabOperator.invoke();
168
169         Node node=new Node(runtime.tree(),"HTTP Server");
170     new PropertiesAction().performPopup(node);
171     }
172
173     private void waitServerRunning(boolean running) {
174         int i;
175         for (i=1;i<=10;i++) {
176             if (serverSettings.isRunning() == running)
177                 break;
178             try { Thread.currentThread().sleep(i*300); }
179             catch (InterruptedException JavaDoc e) {}
180         }
181         if (i == 11)
182             fail("Timeout expired when waiting for server to "+(running?"start":"stop")+" running.");
183     }
184     
185     private void startHTTPServer() {
186
187     RuntimeTabOperator runtime = RuntimeTabOperator.invoke();
188         Node node=new Node(runtime.tree(),"HTTP Server");
189         
190         if (!serverSettings.isRunning()) {
191             new ActionNoBlock(null,"Start HTTP Server").performPopup(node);
192             waitServerRunning(true);
193             waitFor(500);
194         }
195     }
196     
197     private void stopHTTPServer() {
198         
199         RuntimeTabOperator runtime = RuntimeTabOperator.invoke();
200         Node node=new Node(runtime.tree(),"HTTP Server");
201
202         if (serverSettings.isRunning()) {
203             new ActionNoBlock(null,"Stop HTTP Server").performPopup(node);
204             waitServerRunning(false);
205             waitFor(500);
206         }
207     }
208     
209     private void restartHTTPServer() {
210         
211         RuntimeTabOperator runtime = RuntimeTabOperator.invoke();
212         Node node=new Node(runtime.tree(),"HTTP Server");
213
214         if (serverSettings.isRunning()) {
215             new ActionNoBlock(null,"Stop HTTP Server").performPopup(node);
216             waitServerRunning(false);
217             waitFor(500);
218         }
219         new ActionNoBlock(null,"Start HTTP Server").performPopup(node);
220         waitServerRunning(true);
221         waitFor(500);
222     }
223
224     private void checkResult(String JavaDoc path, int index, String JavaDoc output, boolean expectedFail) {
225         URL url = null;
226         try {
227             if (path.startsWith("http://"))
228                 url = new URL(path);
229             else
230                 url = new URL("http","localhost",serverSettings.getPort(),path);
231             URLConnection connection = url.openConnection();
232             BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
233             String JavaDoc line = null;
234             for (int i=0; i<index; i++) {
235                 line = reader.readLine();
236                 if (line == null) break;
237             }
238             reader.close();
239             if (expectedFail) {
240                 fail("Expected to unable to read from '" + url.toString() + "', but it's accessible.");
241             } else {
242                 if (line == null)
243                     fail("No line "+index+" found when reading from '" + url.toString() + "'. Expected to read text including with '"+output+"'.");
244                 if (line.indexOf(output)<0)
245                     fail("Different text read in line "+index+" from '" + url.toString() + "'. Expected to read text including with '"+output+"'.\nLine "+index+": "+line);
246             }
247         } catch (IOException ioe) {
248             if (!expectedFail)
249                 throw new AssertionFailedErrorException("IOException during reading from '" + (url==null?"null":url.toString()) + "'.",ioe);
250         }
251     }
252       
253     /*
254     private boolean checkResult(String url, String output) {
255      
256     HtmlBrowser browser = new HtmlBrowser ();
257     browser.setURL(url);
258     browser.requestFocus();
259
260     JFrame jw = new JFrame();
261     jw.getContentPane().add(browser);
262         jw.setSize(200,200);
263     jw.show ();
264
265         try { Thread.currentThread().sleep(15000); }
266         catch (InterruptedException e) {}
267         
268     JFrameOperator nfo=new JFrameOperator(jw);
269     waitFor(5000);
270
271     String result=new JTextComponentOperator(nfo, 0).getText();
272
273     if (-1==result.indexOf(output)) {
274         nfo.close();
275         return false;
276     } else {
277         nfo.close();
278         return true;
279     }
280     }
281     */

282
283 // Internal HTTP Server Test Specification: Test suite: 1. Browsing of User Repository
284

285
286 // 1.1
287
public void test_1_1() {
288
289         /*
290     switchToHTTPServerNode();
291         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
292         psto = pw.getPropertySheetTabOperator("Expert");
293         
294     TextFieldProperty tf=new TextFieldProperty(psto,"Base Filesystems URL");
295     tf.setValue("repository"); // NOI18
296     pw.close();
297         */

298          
299     startHTTPServer();
300
301     checkResult("/",3,"<title>Directory Listing for:/</title>",false);
302     }
303   
304 // 1.5
305
public void test_1_5() {
306         
307         switchToHTTPServerNode();
308         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
309         psto = pw.getPropertySheetTabOperator("Expert");
310         
311         TextFieldProperty tf=new TextFieldProperty(psto,"Base Filesystems URL");
312         tf.setValue("repository"); // NOI18N
313
tf=new TextFieldProperty(psto,"Port");
314     originalPort = tf.getValue();
315         pw.close();
316         
317         startHTTPServer();
318         checkResult("/repository/org/netbeans/test/gui/httpserver/test.txt",1,"This is test file",false);
319     }
320
321 // Internal HTTP Server Test Specification: Test suite: 2. Accessing Items on IDE Classpath
322

323 // 2.1
324
public void test_2_1() {
325
326     switchToHTTPServerNode();
327         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
328         psto = pw.getPropertySheetTabOperator("Expert");
329
330     TextFieldProperty tf=new TextFieldProperty(psto,"Base Class Path URL");
331     tf.setValue("classpath"); // NOI18N
332
pw.close();
333
334     startHTTPServer();
335
336     checkResult("/classpath/",1,"<HTML><HEAD><TITLE>Filesystems</TITLE></HEAD>",false);
337     }
338
339 // 2.2
340
public void test_2_2() {
341
342     switchToHTTPServerNode();
343         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
344         psto = pw.getPropertySheetTabOperator("Expert");
345
346     TextFieldProperty tf=new TextFieldProperty(psto,"Base Class Path URL");
347     tf.setValue("classpath"); // NOI18N
348
pw.close();
349
350     startHTTPServer();
351
352     checkResult("/classpath/org/netbeans/core/resources/templatesFileSystems.html",
353                     15,"Select the type of filesystem that you want to mount.",false);
354     }
355
356 // Internal HTTP Server Test Specification: Test suite: 3. Accessing Javadoc
357

358 // 3.1
359
public void test_3_1() {
360
361     switchToHTTPServerNode();
362         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
363         psto = pw.getPropertySheetTabOperator("Expert");
364
365     TextFieldProperty tf=new TextFieldProperty(psto,"Base Javadoc URL");
366     tf.setValue("javadoc"); // NOI18N
367
pw.close();
368
369     startHTTPServer();
370
371     checkResult("/javadoc/",2,"List of Javadoc mounts",false);
372     }
373
374 // 3.2
375
public void test_3_2() {
376         
377         switchToHTTPServerNode();
378         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
379         psto = pw.getPropertySheetTabOperator("Expert");
380         
381         TextFieldProperty tf=new TextFieldProperty(psto,"Base Javadoc URL");
382         tf.setValue("javadoc"); // NOI18N
383
pw.close();
384         
385         startHTTPServer();
386         
387         checkResult("/resource/Mount%2FJavadoc%2Forg-netbeans-modules-xml-tools-resources-xml_apis.xml/javax/xml/parsers/SAXParser.html",
388         7,"JAXP 1.1, DOM2, SAX2, SAX2-ext 1.0: Class SAXParser",false);
389     }
390
391 // Internal HTTP Server Test Specification: Test suite: 4. Module Properties
392

393 // 4.1 Hosts with Granted Access
394

395 // 4.1.1
396
public void test_4_1_1() {
397
398     switchToHTTPServerNode();
399         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
400         psto = pw.getPropertySheetTabOperator("Properties");
401
402     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
403     tf.setValue(originalPort); // NOI18N
404
tf=new TextFieldProperty(psto,"Hosts with Granted Access");
405     tf.setValue("Selected Hosts: ");
406
407         psto = pw.getPropertySheetTabOperator("Expert");
408
409     //tf=new TextFieldProperty(psto,"Base Filesystems URL");
410
//tf.setValue("repository"); // NOI18N
411
pw.close();
412
413     startHTTPServer();
414
415     checkResult("/",3,"<title>Directory Listing for:/</title>",false);
416     }
417
418 // 4.2 Port
419

420 // 4.2.1
421
public void test_4_2_1() {
422
423     switchToHTTPServerNode();
424         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
425         psto = pw.getPropertySheetTabOperator("Properties");
426
427     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
428     tf.setValue("16384"); // NOI18N
429

430         psto = pw.getPropertySheetTabOperator("Expert");
431
432     //tf=new TextFieldProperty(psto,"Base Filesystems URL");
433
//tf.setValue("repository"); // NOI18N
434
pw.close();
435
436     startHTTPServer();
437
438     checkResult("http://localhost:16384/",3,"<title>Directory Listing for:/</title>",false);
439     }
440
441 // 4.2.2
442
public void test_4_2_2() {
443
444     switchToHTTPServerNode();
445         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
446         psto = pw.getPropertySheetTabOperator("Properties");
447
448     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
449     tf.setValue("16384"); // NOI18N
450

451         psto = pw.getPropertySheetTabOperator("Expert");
452
453     //tf=new TextFieldProperty(psto,"Base Filesystems URL");
454
//tf.setValue("repository"); // NOI18N
455
pw.close();
456
457     startHTTPServer();
458
459     checkResult("http://localhost:"+originalPort+"/",3,"<title>Directory Listing for:/</title>",true);
460     }
461  
462 // 4.2.4
463
public void test_4_2_4() {
464
465     switchToHTTPServerNode();
466         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
467         psto = pw.getPropertySheetTabOperator("Properties");
468
469     final TextFieldProperty tf=new TextFieldProperty(psto,"Port");
470
471     value=tf.getValue();
472     new Thread JavaDoc() {
473             public void run() { tf.setValue("-9999"); }
474         }.start();
475         
476         AssertionFailedErrorException e = checkDialog("Error");
477         tf.setValue(value);
478         pw.close();
479     if (e != null)
480             throw e;
481     }
482
483 // 4.2.5
484
public void test_4_2_5() {
485
486     switchToHTTPServerNode();
487         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
488         psto = pw.getPropertySheetTabOperator("Properties");
489
490     final TextFieldProperty tf=new TextFieldProperty(psto,"Port");
491
492     value=tf.getValue();
493     new Thread JavaDoc() {
494             public void run() {tf.setValue("0"); }
495         }.start();
496
497         AssertionFailedErrorException e = checkDialog("Error");
498         tf.setValue(value);
499         pw.close();
500         if (e != null)
501             throw e;
502     }
503
504 // 4.2.6
505
public void test_4_2_6() {
506
507     switchToHTTPServerNode();
508         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
509         psto = pw.getPropertySheetTabOperator("Properties");
510
511     final TextFieldProperty tf=new TextFieldProperty(psto,"Port");
512
513     value=tf.getValue();
514     new Thread JavaDoc() {
515             public void run() {tf.setValue("65536"); }
516         }.start();
517
518         AssertionFailedErrorException e = checkDialog("Error");
519         tf.setValue(value);
520         pw.close();
521         if (e != null)
522             throw e;
523     }
524     
525 // 4.2.7
526
public void test_4_2_7() {
527
528     switchToHTTPServerNode();
529         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
530         psto = pw.getPropertySheetTabOperator("Properties");
531
532     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
533     tf.setValue("65535"); // NOI18N
534

535         psto = pw.getPropertySheetTabOperator("Expert");
536
537     //tf=new TextFieldProperty(psto,"Base Filesystems URL");
538
//tf.setValue("repository"); // NOI18N
539
pw.close();
540
541     startHTTPServer();
542
543     checkResult("http://localhost:65535/",3,"<title>Directory Listing for:/</title>",false);
544     }
545
546
547 // 4.3 Running
548

549 // 4.3.1
550
public void test_4_3_1() {
551
552     switchToHTTPServerNode();
553         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
554         psto = pw.getPropertySheetTabOperator("Properties");
555
556     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
557     tf.setValue("16384"); // NOI18N
558

559         psto = pw.getPropertySheetTabOperator("Expert");
560
561     //tf=new TextFieldProperty(psto,"Base Filesystems URL");
562
//tf.setValue("repository"); // NOI18N
563
pw.close();
564
565     stopHTTPServer();
566
567     checkResult("http://localhost:65535/",3,"<title>Directory Listing for:/</title>",true);
568     }
569
570 // 4.3.2
571
public void test_4_3_2() {
572
573     switchToHTTPServerNode();
574         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
575         psto = pw.getPropertySheetTabOperator("Properties");
576
577     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
578     tf.setValue("16384"); // NOI18N
579

580         psto = pw.getPropertySheetTabOperator("Expert");
581
582     //tf=new TextFieldProperty(psto,"Base Filesystems URL");
583
//tf.setValue("repository"); // NOI18N
584
pw.close();
585
586     startHTTPServer();
587
588     checkResult("http://localhost:16384/",3,"<title>Directory Listing for:/</title>",false);
589     }
590
591 // 4.5 Base Filesystems URL
592

593 // 4.5.1
594
public void test_4_5_1() {
595
596     switchToHTTPServerNode();
597         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
598         psto = pw.getPropertySheetTabOperator("Expert");
599
600     TextFieldProperty tf=new TextFieldProperty(psto,"Base Filesystems URL");
601     tf.setValue(""); // NOI18N
602

603     String JavaDoc value=tf.getValue();
604     tf.setValue("/repository/"); // NOI18N
605

606         AssertionFailedErrorException e = checkDialog("Information");
607         pw.close();
608
609         if (e != null)
610             throw e;
611
612         if (!value.equals("/"))
613         fail("Invalid 'Base Filesystems URL' field value");
614     }
615     
616 // 4.5.2
617
public void test_4_5_2() {
618
619     switchToHTTPServerNode();
620         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
621         psto = pw.getPropertySheetTabOperator("Properties");
622
623     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
624     tf.setValue(originalPort); // NOI18N
625

626         psto = pw.getPropertySheetTabOperator("Expert");
627
628     tf=new TextFieldProperty(psto,"Base Filesystems URL");
629     tf.setValue(""); // NOI18N
630
AssertionFailedErrorException e = checkDialog("Information");
631         pw.close();
632         if (e != null)
633             throw e;
634     
635     startHTTPServer();
636         checkResult("http://localhost:"+originalPort+"/repository/",1,"<HTML><HEAD><TITLE>Filesystems</TITLE></HEAD>",true);
637     }
638
639 // 4.5.3
640
public void test_4_5_3() {
641
642     switchToHTTPServerNode();
643         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
644         psto = pw.getPropertySheetTabOperator("Properties");
645
646     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
647     tf.setValue(originalPort); // NOI18N
648

649         psto = pw.getPropertySheetTabOperator("Expert");
650
651     tf=new TextFieldProperty(psto,"Base Filesystems URL");
652     tf.setValue(""); // NOI18N
653
pw.close();
654
655     startHTTPServer();
656
657         checkResult("http://localhost:"+originalPort+"/",1,"<HTML><HEAD><TITLE>Filesystems</TITLE></HEAD>",false);
658     }
659     
660 // 4.5.4
661
public void test_4_5_4() {
662
663     switchToHTTPServerNode();
664         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
665         psto = pw.getPropertySheetTabOperator("Properties");
666
667     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
668     tf.setValue(originalPort); // NOI18N
669

670         psto = pw.getPropertySheetTabOperator("Expert");
671
672     tf=new TextFieldProperty(psto,"Base Filesystems URL");
673     tf.setValue("newrepository"); // NOI18N
674
pw.close();
675
676     startHTTPServer();
677
678         checkResult("http://localhost:"+originalPort+"/newrepository/",1,"<HTML><HEAD><TITLE>Filesystems</TITLE></HEAD>",false);
679     }
680
681     
682 // 4.6 Base Class Path URL
683

684 // 4.6.1
685
public void test_4_6_1() {
686     
687     switchToHTTPServerNode();
688         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
689         psto = pw.getPropertySheetTabOperator("Expert");
690
691     TextFieldProperty tf1=new TextFieldProperty(psto,"Base Filesystems URL");
692     TextFieldProperty tf2=new TextFieldProperty(psto,"Base Class Path URL");
693
694     tf1.setValue("foo1"); // NOI18N
695
tf2.setValue("foo1"); // NOI18N
696

697         AssertionFailedErrorException e = checkDialog("Information");
698         
699         tf1.setValue("repository"); // NOI18N
700
tf2.setValue("classpath"); // NOI18N
701
pw.close();
702         
703         if (e != null)
704             throw e;
705     }
706
707 // 4.6.2
708
public void test_4_6_2() {
709
710     switchToHTTPServerNode();
711         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
712         psto = pw.getPropertySheetTabOperator("Expert");
713
714     TextFieldProperty tf=new TextFieldProperty(psto,"Base Class Path URL");
715     tf.setValue(""); // NOI18N
716

717         AssertionFailedErrorException e = checkDialog("Information");
718         String JavaDoc value=tf.getValue();
719     tf.setValue("/classpath/");
720         pw.close();
721         
722         if (e != null)
723             throw e;
724         
725     if (!value.equals("/")) { // NOI18N
726
pw.close();
727         fail("Invalid 'Base Class Path URL' field value");
728     }
729
730     
731     }
732
733 // 4.6.3
734
public void test_4_6_3() {
735
736     switchToHTTPServerNode();
737         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
738         psto = pw.getPropertySheetTabOperator("Properties");
739
740     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
741     tf.setValue(originalPort); // NOI18N
742

743         psto = pw.getPropertySheetTabOperator("Expert");
744
745     tf=new TextFieldProperty(psto,"Base Class Path URL");
746     tf.setValue(""); // NOI18N
747

748         AssertionFailedErrorException e = checkDialog("Information");
749         
750     pw.close();
751         
752         if (e != null)
753             throw e;
754         
755     startHTTPServer();
756
757         checkResult("http://localhost:"+originalPort+"/classpath/org/netbeans/core/resources/templatesFileSystems.html",
758                     15,"Select the type of filesystem that you want to mount.",true);
759     }
760
761 // 4.6.4
762
public void test_4_6_4() {
763
764     switchToHTTPServerNode();
765         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
766         psto = pw.getPropertySheetTabOperator("Properties");
767
768     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
769     tf.setValue(originalPort); // NOI18N
770

771         psto = pw.getPropertySheetTabOperator("Expert");
772
773     tf=new TextFieldProperty(psto,"Base Class Path URL");
774     tf.setValue(""); // NOI18N
775
pw.close();
776
777     startHTTPServer();
778
779         checkResult("http://localhost:"+originalPort+"/org/netbeans/core/resources/templatesFileSystems.html",
780                     15,"Select the type of filesystem that you want to mount.",false);
781     }
782     
783 // 4.6.5
784
public void test_4_6_5() {
785
786     switchToHTTPServerNode();
787         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
788         psto = pw.getPropertySheetTabOperator("Properties");
789
790     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
791     tf.setValue(originalPort); // NOI18N
792

793         psto = pw.getPropertySheetTabOperator("Expert");
794
795     tf=new TextFieldProperty(psto,"Base Class Path URL");
796     tf.setValue("newclasspath"); // NOI18N
797
pw.close();
798
799     startHTTPServer();
800
801         checkResult("http://localhost:"+originalPort+"/newclasspath/org/netbeans/core/resources/templatesFileSystems.html",
802         15,"Select the type of filesystem that you want to mount.",false);
803   
804     }
805
806 // 4.7 Base Javadoc URL
807

808 // 4.7.1
809
public void test_4_7_1() {
810
811     switchToHTTPServerNode();
812         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
813         psto = pw.getPropertySheetTabOperator("Expert");
814
815     TextFieldProperty tf1=new TextFieldProperty(psto,"Base Filesystems URL");
816     TextFieldProperty tf2=new TextFieldProperty(psto,"Base Javadoc URL");
817
818     tf1.setValue("foo2"); // NOI18N
819
tf2.setValue("foo2"); // NOI18N
820

821         AssertionFailedErrorException e = checkDialog("Information");
822         
823         tf1.setValue("repository"); // NOI18N
824
tf2.setValue("javadoc"); // NOI18N
825
pw.close();
826
827         if (e != null) {
828         throw e;
829     }
830     }
831
832 // 4.7.2
833
public void test_4_7_2() {
834
835     switchToHTTPServerNode();
836         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
837         psto = pw.getPropertySheetTabOperator("Expert");
838
839     TextFieldProperty tf=new TextFieldProperty(psto,"Base Javadoc URL");
840     tf.setValue(""); // NOI18N
841

842     String JavaDoc value=tf.getValue();
843         AssertionFailedErrorException e = checkDialog("Information");
844
845         tf.setValue("/javadoc/"); // NOI18N
846
pw.close();
847
848         if (e != null) {
849                 throw e;
850     }
851  
852     if (!value.equals("/")) { // NOI18N
853
fail("Invalid 'Base Javadoc URL' field value");
854     }
855     }
856
857 // 4.7.3
858
public void test_4_7_3() {
859
860     switchToHTTPServerNode();
861         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
862         psto = pw.getPropertySheetTabOperator("Properties");
863
864     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
865     tf.setValue(originalPort); // NOI18N
866

867         psto = pw.getPropertySheetTabOperator("Expert");
868
869     tf=new TextFieldProperty(psto,"Base Javadoc URL");
870     tf.setValue(""); // NOI18N
871

872         AssertionFailedErrorException e = checkDialog("Information");
873  
874     pw.close();
875  
876         if (e != null) {
877                 throw e;
878         }
879  
880     startHTTPServer();
881
882         checkResult("http://localhost:"+originalPort+"/javadoc/",2,"List of Javadoc mounts",true);
883     }
884
885 // 4.7.4
886
public void test_4_7_4() {
887
888     switchToHTTPServerNode();
889         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
890         psto = pw.getPropertySheetTabOperator("Properties");
891
892     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
893     tf.setValue(originalPort); // NOI18N
894

895         psto = pw.getPropertySheetTabOperator("Expert");
896
897     tf=new TextFieldProperty(psto,"Base Javadoc URL");
898     tf.setValue(""); // NOI18N
899
pw.close();
900
901     startHTTPServer();
902
903         checkResult("http://localhost:"+originalPort+"/",2,"List of Javadoc mounts",false);
904     }
905     
906 // 4.7.5
907
public void test_4_7_5() {
908
909     switchToHTTPServerNode();
910         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
911         psto = pw.getPropertySheetTabOperator("Properties");
912
913     TextFieldProperty tf=new TextFieldProperty(psto,"Port");
914     tf.setValue(originalPort); // NOI18N
915

916         psto = pw.getPropertySheetTabOperator("Expert");
917
918     tf=new TextFieldProperty(psto,"Base Javadoc URL");
919     tf.setValue("newjavadoc"); // NOI18N
920
pw.close();
921
922     startHTTPServer();
923
924         checkResult("http://localhost:"+originalPort+"/newjavadoc/",2,"List of Javadoc mounts",false);
925     }
926
927
928 // 4.8 General Behavior
929

930 // 4.8.1
931
public void test_4_8_01() {
932
933     switchToHTTPServerNode();
934         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
935         psto = pw.getPropertySheetTabOperator("Properties");
936
937     TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
938     tf.openEditor();
939
940         AssertionFailedErrorException e = checkDialog("Hosts with Granted Access");
941         pw.close();
942         if (e != null)
943             throw e;
944     }
945
946 // 4.8.2
947
public void test_4_8_02() {
948     
949     switchToHTTPServerNode();
950         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
951         psto = pw.getPropertySheetTabOperator("Properties");
952
953     TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
954     tf.setValue("Selected Hosts: ");
955     tf.openEditor();
956
957     try {
958         dop=new NbDialogOperator("Hosts with Granted Access");
959     } catch(Exception JavaDoc ex) {
960         pw.close();
961         throw new AssertionFailedErrorException("No 'Hosts with Granted Access' dialog appears",ex);
962     }
963
964     JRadioButtonOperator rb=new JRadioButtonOperator(dop,"Any Host");
965     rb.doClick();
966     JButtonOperator cancel=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "CANCEL_OPTION_CAPTION"));
967     cancel.doClick();
968
969     value=tf.getValue();
970     if (!value.equals("Selected Hosts: ")) {
971         pw.close();
972         fail("Cancel doesn't work.");
973     }
974
975     pw.close();
976     }
977
978 // 4.8.3
979
public void test_4_8_03() {
980
981     switchToHTTPServerNode();
982         PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
983         psto = pw.getPropertySheetTabOperator("Properties");
984
985     TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
986     tf.setValue("Selected Hosts: ");
987     tf.openEditor();
988
989     try {
990         dop=new NbDialogOperator("Hosts with Granted Access");
991     } catch(Exception JavaDoc ex) {
992         pw.close();
993         throw new AssertionFailedErrorException("No 'Hosts with Granted Access' dialog appears",ex);
994     }
995
996     JRadioButtonOperator rb=new JRadioButtonOperator(dop,"Any Host");
997     rb.doClick();
998     JButtonOperator ok=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION"));
999     ok.doClick();
1000
1001    value=tf.getValue();
1002    if (!value.equals("Any Host")){
1003        pw.close();
1004        fail("'Any Host' isn't set.");
1005    }
1006
1007    pw.close();
1008    }
1009
1010// 4.8.4
1011
public void test_4_8_04() {
1012
1013    switchToHTTPServerNode();
1014        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1015        psto = pw.getPropertySheetTabOperator("Properties");
1016
1017    TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
1018        tf.setValue("foo"); // NOI18N
1019

1020        value=tf.getValue();
1021    pw.close();
1022    if (!value.equals("Selected Hosts: foo")) {
1023        pw.close();
1024        fail("'Selected Hosts: foo' isn't set.");
1025    }
1026    }
1027
1028// 4.8.5
1029
public void test_4_8_05() {
1030
1031    switchToHTTPServerNode();
1032        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1033        psto = pw.getPropertySheetTabOperator("Properties");
1034
1035    TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
1036    tf.setValue("Any Host");
1037    tf.openEditor();
1038
1039    try {
1040        dop=new NbDialogOperator("Hosts with Granted Access");
1041    } catch(Exception JavaDoc ex) {
1042        pw.close();
1043        throw new AssertionFailedErrorException("No 'Hosts with Granted Access' dialog appears",ex);
1044    }
1045
1046    JRadioButtonOperator rb=new JRadioButtonOperator(dop,"Selected Hosts");
1047    rb.doClick();
1048    JButtonOperator ok=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION"));
1049    ok.doClick();
1050
1051    value=tf.getValue();
1052    pw.close();
1053    if (!value.equals("Selected Hosts: ")) {
1054        pw.close();
1055        fail("'Selected Hosts: ' isn't set.");
1056    }
1057
1058    }
1059
1060// 4.8.6
1061
public void test_4_8_06() {
1062
1063    switchToHTTPServerNode();
1064        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1065        psto = pw.getPropertySheetTabOperator("Properties");
1066
1067    Property tf=new Property(psto,"Hosts with Granted Access");
1068    old_value=tf.getValue();
1069
1070        
1071    //JTextFieldOperator to=tf.textField();
1072
//to.typeText("Selected Hosts: localhost");
1073
tf.setValue("Selected Hosts: localhost");
1074
1075        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1076        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1077
1078        /*
1079    try {
1080        Robot rb=new java.awt.Robot();
1081        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1082        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1083    } catch (Exception AWTException) {
1084        System.out.println("AWTException in test_4_8_6"); // NOI18N
1085    }
1086        */

1087
1088    value=tf.getValue();
1089    if (!value.equals("Selected Hosts: localhost")) {
1090        pw.close();
1091        fail("Invalid 'Hosts with Granted Access' field value ("+value+")");
1092    }
1093
1094    tf.setValue(old_value);
1095    pw.close();
1096    }
1097
1098// 4.8.7
1099
public void test_4_8_07() {
1100
1101    switchToHTTPServerNode();
1102        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1103        psto = pw.getPropertySheetTabOperator("Properties");
1104
1105    TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
1106    old_value=tf.getValue();
1107
1108    //JTextFieldOperator to=tf.textField();
1109
//to.typeText("Selected Hosts: localhost, boo");
1110
tf.setValue("Selected Hosts: localhost, boo");
1111
1112        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1113        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1114        /*
1115    try {
1116        Robot rb=new java.awt.Robot();
1117        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1118        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1119    } catch (Exception AWTException) {
1120        System.out.println("AWTException in test_4_8_7"); // NOI18N
1121    }
1122        */

1123
1124    value=tf.getValue();
1125    if (!value.equals("Selected Hosts: localhost, boo")) {
1126        pw.close();
1127        fail("Invalid 'Hosts with Granted Access' field value ("+value+")");
1128    }
1129
1130    pw.close();
1131    }
1132
1133// 4.8.8
1134
public void test_4_8_08() {
1135
1136    switchToHTTPServerNode();
1137        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1138        psto = pw.getPropertySheetTabOperator("Properties");
1139
1140    TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
1141        tf.setValue("Selected Hosts: localhost, boo");
1142    tf.openEditor();
1143
1144    try {
1145        dop=new NbDialogOperator("Hosts with Granted Access");
1146    } catch(Exception JavaDoc ex) {
1147        //dop.close();
1148
pw.close();
1149        throw new AssertionFailedErrorException("No 'Hosts with Granted Access' dialog appears",ex);
1150    }
1151
1152    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1153    value=jt.getText();
1154    if (!value.equals("localhost, boo")) {
1155        dop.close();
1156            pw.close();
1157        fail("Invalid 'Grant Access to:' textarea value ("+value+")");
1158    }
1159
1160    dop.close();
1161    pw.close();
1162    }
1163
1164// 4.8.9
1165
public void test_4_8_09() {
1166
1167    switchToHTTPServerNode();
1168        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1169        psto = pw.getPropertySheetTabOperator("Expert");
1170
1171    TextFieldProperty tf=new TextFieldProperty(psto,"Base Class Path URL");
1172    tf.openEditor();
1173
1174        
1175        AssertionFailedErrorException e = checkDialog("Base Class Path URL");
1176        // What is in value ????
1177
//tf.setValue(value);
1178
pw.close();
1179        if (e != null)
1180            throw e;
1181        
1182    }
1183
1184// 4.8.10
1185
public void test_4_8_10() {
1186
1187    switchToHTTPServerNode();
1188        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1189        psto = pw.getPropertySheetTabOperator("Expert");
1190
1191    TextFieldProperty tf=new TextFieldProperty(psto,"Base Class Path URL");
1192    tf.openEditor();
1193    
1194    try {
1195        dop=new NbDialogOperator("Base Class Path URL");
1196    } catch(Exception JavaDoc ex) {
1197                //dop.close();
1198
pw.close();
1199        throw new AssertionFailedErrorException("No 'Base Class Path URL' dialog appears",ex);
1200    }
1201
1202    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1203    value=jt.getText();
1204    jt.setText("/qqqqqqq/"); // NOI18N
1205
JButtonOperator cancel=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "CANCEL_OPTION_CAPTION"));
1206    cancel.doClick();
1207
1208    if (!value.equals(tf.getValue())) {
1209        pw.close();
1210        fail("Cancel in 'Base Class Path URL' dialog doesn't work");
1211    }
1212
1213    pw.close();
1214    }
1215
1216// 4.8.11
1217
public void test_4_8_11() {
1218
1219    switchToHTTPServerNode();
1220        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1221        psto = pw.getPropertySheetTabOperator("Expert");
1222
1223    TextFieldProperty tf=new TextFieldProperty(psto,"Base Class Path URL");
1224    old_value=tf.getValue();
1225
1226    //JTextFieldOperator to=tf.textField();
1227
//to.typeText("/testvalue_cp/"); // NOI18N
1228
tf.setValue("/testvalue_cp/"); // NOI18N
1229

1230        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1231        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1232        /*
1233    try {
1234        Robot rb=new java.awt.Robot();
1235        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1236        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1237    } catch (Exception AWTException) {
1238        System.out.println("AWTException in test_4_8_12"); // NOI18N
1239    }
1240        */

1241
1242    value=tf.getValue();
1243    if (!value.equals("/testvalue_cp/")) { // NOI18N
1244
pw.close();
1245        fail("Invalid 'Base Class Path URL' field value ("+value+")");
1246    }
1247
1248    pw.close();
1249    }
1250
1251// 4.8.12
1252
public void test_4_8_12() {
1253
1254    switchToHTTPServerNode();
1255        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1256        psto = pw.getPropertySheetTabOperator("Expert");
1257
1258    TextFieldProperty tf=new TextFieldProperty(psto,"Base Class Path URL");
1259        tf.setValue("/testvalue_cp/"); // NOI18N
1260
tf.openEditor();
1261    
1262    try {
1263        dop=new NbDialogOperator("Base Class Path URL");
1264    } catch(Exception JavaDoc ex) {
1265        //dop.close();
1266
pw.close();
1267        throw new AssertionFailedErrorException("No 'Base Class Path URL' dialog appears",ex);
1268    }
1269
1270    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1271    value=jt.getText();
1272    if (!value.equals("/testvalue_cp/")) { // NOI18N
1273
dop.close();
1274        pw.close();
1275        fail("Invalid 'Base Class Path URL' field value ("+value+")");
1276    }
1277
1278    dop.close();
1279    pw.close();
1280    }
1281
1282// 4.8.13
1283
public void test_4_8_13() {
1284
1285    switchToHTTPServerNode();
1286        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1287        psto = pw.getPropertySheetTabOperator("Expert");
1288
1289    TextFieldProperty tf=new TextFieldProperty(psto,"Base Class Path URL");
1290    tf.openEditor();
1291    
1292    try {
1293        dop=new NbDialogOperator("Base Class Path URL");
1294    } catch(Exception JavaDoc ex) {
1295        //dop.close();
1296
pw.close();
1297        throw new AssertionFailedErrorException("No 'Base Class Path URL' dialog appears",ex);
1298    }
1299
1300    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1301    jt.setText("classpath"); // NOI18N
1302

1303    JButtonOperator ok=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION"));
1304    ok.doClick();
1305    value=tf.getValue();
1306
1307    if (!value.equals("/classpath/")) { // NOI18N
1308
dop.close();
1309        pw.close();
1310        fail("Invalid 'Base Class Path URL' field value ("+value+")");
1311    }
1312
1313    pw.close();
1314    }
1315
1316// 4.8.14
1317
public void test_4_8_14() {
1318
1319    switchToHTTPServerNode();
1320        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1321        psto = pw.getPropertySheetTabOperator("Expert");
1322
1323    TextFieldProperty tf=new TextFieldProperty(psto,"Base Filesystems URL");
1324    tf.openEditor();
1325
1326        AssertionFailedErrorException e = checkDialog("Base Filesystems URL");
1327        // what is in value???
1328
//tf.setValue(value);
1329
pw.close();
1330        if (e != null)
1331            throw e;
1332    }
1333
1334// 4.8.15
1335
public void test_4_8_15() {
1336
1337    switchToHTTPServerNode();
1338        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1339        psto = pw.getPropertySheetTabOperator("Expert");
1340
1341    TextFieldProperty tf=new TextFieldProperty(psto,"Base Filesystems URL");
1342    tf.openEditor();
1343    
1344    try {
1345        dop=new NbDialogOperator("Base Filesystems URL");
1346    } catch(Exception JavaDoc ex) {
1347        //dop.close();
1348
pw.close();
1349        throw new AssertionFailedErrorException("No 'Base Filesystems URL' dialog appears",ex);
1350    }
1351
1352    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1353    value=jt.getText();
1354    jt.setText("/qqqqqqq/"); // NOI18N
1355
JButtonOperator cancel=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "CANCEL_OPTION_CAPTION"));
1356    cancel.doClick();
1357
1358    if (!value.equals(tf.getValue())) {
1359        dop.close();
1360        pw.close();
1361        fail("Cancel in 'Base Filesystems URL' dialog doesn't work");
1362    }
1363
1364    pw.close();
1365    }
1366
1367// 4.8.16
1368
public void test_4_8_16() {
1369
1370    switchToHTTPServerNode();
1371        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1372        psto = pw.getPropertySheetTabOperator("Expert");
1373
1374    TextFieldProperty tf=new TextFieldProperty(psto,"Base Filesystems URL");
1375    old_value=tf.getValue();
1376
1377    //JTextFieldOperator to=tf.textField();
1378
//to.typeText("/testvalue_fs/"); // NOI18N
1379
tf.setValue("/testvalue_fs/"); // NOI18N
1380

1381        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1382        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1383        /*
1384    try {
1385        Robot rb=new java.awt.Robot();
1386        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1387        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1388    } catch (Exception AWTException) {
1389        System.out.println("AWTException in test_4_8_17"); // NOI18N
1390    }
1391        */

1392
1393    value=tf.getValue();
1394    if (!value.equals("/testvalue_fs/")) { // NOI18N
1395
pw.close();
1396        fail("Invalid 'Base Filesystems URL' field value ("+value+")");
1397    }
1398
1399    pw.close();
1400    }
1401
1402// 4.8.17
1403
public void test_4_8_17() {
1404
1405    switchToHTTPServerNode();
1406        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1407        psto = pw.getPropertySheetTabOperator("Expert");
1408
1409    TextFieldProperty tf=new TextFieldProperty(psto,"Base Filesystems URL");
1410        tf.setValue("/testvalue_fs/"); // NOI18N
1411
tf.openEditor();
1412    
1413    try {
1414        dop=new NbDialogOperator("Base Filesystems URL");
1415    } catch(Exception JavaDoc ex) {
1416        //dop.close();
1417
pw.close();
1418        throw new AssertionFailedErrorException("No 'Base Filesystems URL' dialog appears",ex);
1419    }
1420
1421    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1422    value=jt.getText();
1423    if (!value.equals("/testvalue_fs/")) { // NOI18N
1424
dop.close();
1425        pw.close();
1426        fail("Invalid 'Base Filesystems URL' field value ("+value+")");
1427    }
1428
1429    dop.close();
1430    pw.close();
1431    }
1432
1433// 4.8.18
1434
public void test_4_8_18() {
1435
1436    switchToHTTPServerNode();
1437        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1438        psto = pw.getPropertySheetTabOperator("Expert");
1439
1440    TextFieldProperty tf=new TextFieldProperty(psto,"Base Filesystems URL");
1441    tf.openEditor();
1442    
1443    try {
1444        dop=new NbDialogOperator("Base Filesystems URL");
1445    } catch(Exception JavaDoc ex) {
1446        //dop.close();
1447
pw.close();
1448        throw new AssertionFailedErrorException("No 'Base Filesystems URL' dialog appears",ex);
1449    }
1450
1451    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1452    jt.setText("repository"); // NOI18N
1453

1454    JButtonOperator ok=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION"));
1455    ok.doClick();
1456    value=tf.getValue();
1457
1458    if (!value.equals("/repository/")) { // NOI18N
1459
dop.close();
1460        pw.close();
1461        fail("Invalid 'Base Filesystems URL' field value ("+value+")");
1462    }
1463
1464    pw.close();
1465    }
1466
1467// 4.8.19
1468
public void test_4_8_19() {
1469
1470    switchToHTTPServerNode();
1471        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1472        psto = pw.getPropertySheetTabOperator("Expert");
1473
1474    TextFieldProperty tf=new TextFieldProperty(psto,"Base Javadoc URL");
1475    tf.openEditor();
1476
1477    
1478        AssertionFailedErrorException e = checkDialog("Base Javadoc URL");
1479        // what is in value???
1480
//tf.setValue(value);
1481
pw.close();
1482        if (e != null)
1483            throw e;
1484    }
1485
1486// 4.8.20
1487
public void test_4_8_20() {
1488
1489    switchToHTTPServerNode();
1490        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1491        psto = pw.getPropertySheetTabOperator("Expert");
1492
1493    TextFieldProperty tf=new TextFieldProperty(psto,"Base Javadoc URL");
1494    tf.openEditor();
1495    
1496    try {
1497        dop=new NbDialogOperator("Base Javadoc URL");
1498    } catch(Exception JavaDoc ex) {
1499        //dop.close();
1500
pw.close();
1501        throw new AssertionFailedErrorException("No 'Base Javadoc URL' dialog appears",ex);
1502    }
1503
1504    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1505    value=jt.getText();
1506    jt.setText("/qqqqqqq/"); // NOI18N
1507
JButtonOperator cancel=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "CANCEL_OPTION_CAPTION"));
1508    cancel.doClick();
1509
1510    if (!value.equals(tf.getValue())) {
1511        dop.close();
1512        pw.close();
1513        fail("Cancel in 'Base Javadoc URL' dialog doesn't work");
1514    }
1515
1516    pw.close();
1517    }
1518
1519// 4.8.21
1520
public void test_4_8_21() {
1521
1522    switchToHTTPServerNode();
1523        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1524        psto = pw.getPropertySheetTabOperator("Expert");
1525
1526    TextFieldProperty tf=new TextFieldProperty(psto,"Base Javadoc URL");
1527    old_value=tf.getValue();
1528
1529    //JTextFieldOperator to=tf.textField();
1530
//to.typeText("/testvalue_jd/"); // NOI18N
1531
tf.setValue("/testvalue_jd/"); // NOI18N
1532

1533        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1534        pw.pushKey(java.awt.event.KeyEvent.VK_TAB);
1535        /*
1536    try {
1537        Robot rb=new java.awt.Robot();
1538        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1539        rb.keyPress(java.awt.event.KeyEvent.VK_TAB);
1540    } catch (Exception AWTException) {
1541        System.out.println("AWTException in test_4_8_22"); // NOI18N
1542    }
1543        */

1544
1545    value=tf.getValue();
1546    if (!value.equals("/testvalue_jd/")) { // NOI18N
1547
pw.close();
1548        fail("Invalid 'Base Javadoc URL' field value ("+value+")");
1549    }
1550
1551    pw.close();
1552    }
1553
1554// 4.8.22
1555
public void test_4_8_22() {
1556
1557    switchToHTTPServerNode();
1558        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1559        psto = pw.getPropertySheetTabOperator("Expert");
1560
1561    TextFieldProperty tf=new TextFieldProperty(psto,"Base Javadoc URL");
1562        tf.setValue("/testvalue_jd/"); // NOI18N
1563
tf.openEditor();
1564    
1565    try {
1566        dop=new NbDialogOperator("Base Javadoc URL");
1567    } catch(Exception JavaDoc ex) {
1568        //dop.close();
1569
pw.close();
1570        throw new AssertionFailedErrorException("No 'Base Javadoc URL' dialog appears",ex);
1571    }
1572
1573    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1574    value=jt.getText();
1575    if (!value.equals("/testvalue_jd/")) { // NOI18N
1576
dop.close();
1577        pw.close();
1578        fail("Invalid 'Base Javadoc URL' field value ("+value+")");
1579    }
1580
1581    dop.close();
1582    pw.close();
1583    }
1584
1585// 4.8.23
1586
public void test_4_8_23() {
1587
1588    switchToHTTPServerNode();
1589        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1590        psto = pw.getPropertySheetTabOperator("Expert");
1591
1592    TextFieldProperty tf=new TextFieldProperty(psto,"Base Javadoc URL");
1593    tf.openEditor();
1594    
1595    try {
1596        dop=new NbDialogOperator("Base Javadoc URL");
1597    } catch(Exception JavaDoc ex) {
1598        //dop.close();
1599
pw.close();
1600        throw new AssertionFailedErrorException("No 'Base Javadoc URL' dialog appears",ex);
1601    }
1602
1603    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1604    jt.setText("javadoc"); // NOI18N
1605

1606    JButtonOperator ok=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION"));
1607    ok.doClick();
1608    value=tf.getValue();
1609
1610    if (!value.equals("/javadoc/")) { // NOI18N
1611
dop.close();
1612        pw.close();
1613        fail("Invalid 'Base Javadoc URL' field value ("+value+")");
1614    }
1615
1616    pw.close();
1617    }
1618
1619// 4.8.24
1620
public void test_4_8_24() {
1621
1622    switchToHTTPServerNode();
1623        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1624        psto = pw.getPropertySheetTabOperator("Properties");
1625
1626    TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
1627    tf.setValue("Any Host");
1628    tf.openEditor();
1629
1630    try {
1631        dop=new NbDialogOperator("Hosts with Granted Access");
1632    } catch(Exception JavaDoc ex) {
1633        pw.close();
1634        throw new AssertionFailedErrorException("No 'Hosts with Granted Access' dialog appears",ex);
1635    }
1636
1637    JRadioButtonOperator rb=new JRadioButtonOperator(dop,"Selected Hosts");
1638    rb.doClick();
1639
1640    JTextAreaOperator jt=new JTextAreaOperator(dop,0);
1641    jt.setText("boo"); // NOI18N
1642

1643    JButtonOperator ok=new JButtonOperator(dop,org.netbeans.jellytools.Bundle.getString("org.netbeans.core.Bundle", "OK_OPTION_CAPTION"));
1644    ok.doClick();
1645
1646    value=tf.getValue();
1647    if (!value.equals("Selected Hosts: boo")) {
1648        pw.close();
1649        fail("'Selected Hosts: ' isn't set. ("+value+")");
1650    }
1651
1652    pw.close();
1653    }
1654
1655// 4.9 Accessibility
1656

1657// 4.9.1
1658
public void test_4_9_1() {
1659
1660    switchToHTTPServerNode();
1661        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1662        psto = pw.getPropertySheetTabOperator("Properties");
1663
1664    TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
1665    tf.setValue("Selected Hosts: ");
1666    tf.openEditor();
1667
1668    try {
1669        dop=new NbDialogOperator("Hosts with Granted Access");
1670    } catch(Exception JavaDoc ex) {
1671        //dop.close();
1672
pw.close();
1673        throw new AssertionFailedErrorException("No 'Hosts with Granted Access' dialog appears",ex);
1674    }
1675
1676        dop.pushKey(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK);
1677        dop.releaseKey(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK);
1678        
1679        /*
1680    try {
1681        Robot rb=new java.awt.Robot();
1682        rb.keyPress(java.awt.event.KeyEvent.VK_ALT);
1683        rb.keyPress(java.awt.event.KeyEvent.VK_N);
1684        rb.keyRelease(java.awt.event.KeyEvent.VK_N);
1685        rb.keyRelease(java.awt.event.KeyEvent.VK_ALT);
1686    } catch (Exception AWTException) {
1687        System.out.println("AWTException in test_4_9_1"); // NOI18N
1688    }
1689         */

1690        
1691
1692    dop.ok();
1693    value=tf.getValue();
1694
1695    if (!value.equals("Any Host")) {
1696        pw.close();
1697        fail("Invalid 'Hosts with Granted Access' field value ("+value+")");
1698    }
1699
1700    pw.close();
1701    }
1702
1703// 4.9.2
1704
public void test_4_9_2() {
1705
1706    switchToHTTPServerNode();
1707        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1708        psto = pw.getPropertySheetTabOperator("Properties");
1709
1710    TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
1711    tf.setValue("Any Host");
1712    tf.openEditor();
1713
1714    try {
1715        dop=new NbDialogOperator("Hosts with Granted Access");
1716    } catch(Exception JavaDoc ex) {
1717        //dop.close();
1718
pw.close();
1719        throw new AssertionFailedErrorException("No 'Hosts with Granted Access' dialog appears",ex);
1720    }
1721
1722        dop.pushKey(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK);
1723        dop.releaseKey(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK);
1724        
1725        /*
1726    try {
1727        Robot rb=new java.awt.Robot();
1728        rb.keyPress(java.awt.event.KeyEvent.VK_ALT);
1729        rb.keyPress(java.awt.event.KeyEvent.VK_S);
1730        rb.keyRelease(java.awt.event.KeyEvent.VK_S);
1731        rb.keyRelease(java.awt.event.KeyEvent.VK_ALT);
1732    } catch (Exception AWTException) {
1733        System.out.println("AWTException in test_4_9_2"); // NOI18N
1734    }
1735        */

1736
1737    dop.ok();
1738    value=tf.getValue();
1739
1740    if (!value.equals("Selected Hosts: ")) {
1741        pw.close();
1742        fail("Invalid 'Hosts with Granted Access' field value");
1743    }
1744
1745    pw.close();
1746    }
1747
1748// 4.9.3
1749
public void test_4_9_3() {
1750
1751    switchToHTTPServerNode();
1752        PropertySheetOperator pw = new PropertySheetOperator("HTTP Server");
1753        psto = pw.getPropertySheetTabOperator("Properties");
1754
1755    TextFieldProperty tf=new TextFieldProperty(psto,"Hosts with Granted Access");
1756    tf.setValue("Selected Hosts: ");
1757    tf.openEditor();
1758
1759    try {
1760        dop=new NbDialogOperator("Hosts with Granted Access");
1761    } catch(Exception JavaDoc ex) {
1762        //dop.close();
1763
pw.close();
1764        throw new AssertionFailedErrorException("No 'Hosts with Granted Access' dialog appears",ex);
1765    }
1766
1767        dop.pushKey(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.ALT_MASK);
1768        dop.releaseKey(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.ALT_MASK);
1769        
1770        /*
1771        JTextAreaOperator jt = new JTextAreaOperator(dop);
1772        jt.pushKey(java.awt.event.KeyEvent.VK_T);
1773        jt.releaseKey(java.awt.event.KeyEvent.VK_T);
1774        jt.pushKey(java.awt.event.KeyEvent.VK_E);
1775        jt.releaseKey(java.awt.event.KeyEvent.VK_E);
1776        jt.pushKey(java.awt.event.KeyEvent.VK_S);
1777        jt.releaseKey(java.awt.event.KeyEvent.VK_S);
1778        jt.pushKey(java.awt.event.KeyEvent.VK_T);
1779        jt.releaseKey(java.awt.event.KeyEvent.VK_T);
1780        */

1781                
1782        
1783        try {
1784        Robot JavaDoc rb=new java.awt.Robot JavaDoc();
1785                /*
1786        rb.keyPress(java.awt.event.KeyEvent.VK_ALT);
1787        rb.keyPress(java.awt.event.KeyEvent.VK_G);
1788        rb.keyRelease(java.awt.event.KeyEvent.VK_G);
1789        rb.keyRelease(java.awt.event.KeyEvent.VK_ALT);
1790                */

1791        rb.keyPress(java.awt.event.KeyEvent.VK_T);
1792        rb.keyRelease(java.awt.event.KeyEvent.VK_T);
1793        rb.keyPress(java.awt.event.KeyEvent.VK_E);
1794        rb.keyRelease(java.awt.event.KeyEvent.VK_E);
1795        rb.keyPress(java.awt.event.KeyEvent.VK_S);
1796        rb.keyRelease(java.awt.event.KeyEvent.VK_S);
1797        rb.keyPress(java.awt.event.KeyEvent.VK_T);
1798        rb.keyRelease(java.awt.event.KeyEvent.VK_T);
1799    } catch (Exception JavaDoc AWTException) {
1800        System.out.println("AWTException in test_4_9_3"); // NOI18N
1801
}
1802        
1803
1804    dop.ok();
1805    value=tf.getValue();
1806
1807    if (!value.equals("Selected Hosts: test")) {
1808        pw.close();
1809        fail("Invalid 'Hosts with Granted Access' field value ("+value+")");
1810    }
1811
1812    pw.close();
1813    }
1814  
1815}
Popular Tags