1 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 ; 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 workDir=null; 46 private String value=null; 47 private String 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 delim="|"; private String failMessage="test failed"; 56 private static String originalPort = "8082"; 57 58 private HttpServerSettings serverSettings = new HttpServerSettings(); 59 60 public Module(String 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 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 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 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 138 public static void main(java.lang.String [] args) { 139 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 int k=1; 151 new EventTool().waitNoEvent(ms*k); 152 } 153 154 private AssertionFailedErrorException checkDialog(String name) { 155 156 try { 157 dop=new NbDialogOperator(name); 158 } catch(Exception 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 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 path, int index, String 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 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 282 283 285 286 public void test_1_1() { 288 289 298 299 startHTTPServer(); 300 301 checkResult("/",3,"<title>Directory Listing for:/</title>",false); 302 } 303 304 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"); 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 323 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"); pw.close(); 333 334 startHTTPServer(); 335 336 checkResult("/classpath/",1,"<HTML><HEAD><TITLE>Filesystems</TITLE></HEAD>",false); 337 } 338 339 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"); 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 358 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"); pw.close(); 368 369 startHTTPServer(); 370 371 checkResult("/javadoc/",2,"List of Javadoc mounts",false); 372 } 373 374 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"); 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 393 395 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); tf=new TextFieldProperty(psto,"Hosts with Granted Access"); 405 tf.setValue("Selected Hosts: "); 406 407 psto = pw.getPropertySheetTabOperator("Expert"); 408 409 pw.close(); 412 413 startHTTPServer(); 414 415 checkResult("/",3,"<title>Directory Listing for:/</title>",false); 416 } 417 418 420 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"); 430 psto = pw.getPropertySheetTabOperator("Expert"); 431 432 pw.close(); 435 436 startHTTPServer(); 437 438 checkResult("http://localhost:16384/",3,"<title>Directory Listing for:/</title>",false); 439 } 440 441 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"); 451 psto = pw.getPropertySheetTabOperator("Expert"); 452 453 pw.close(); 456 457 startHTTPServer(); 458 459 checkResult("http://localhost:"+originalPort+"/",3,"<title>Directory Listing for:/</title>",true); 460 } 461 462 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 () { 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 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 () { 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 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 () { 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 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"); 535 psto = pw.getPropertySheetTabOperator("Expert"); 536 537 pw.close(); 540 541 startHTTPServer(); 542 543 checkResult("http://localhost:65535/",3,"<title>Directory Listing for:/</title>",false); 544 } 545 546 547 549 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"); 559 psto = pw.getPropertySheetTabOperator("Expert"); 560 561 pw.close(); 564 565 stopHTTPServer(); 566 567 checkResult("http://localhost:65535/",3,"<title>Directory Listing for:/</title>",true); 568 } 569 570 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"); 580 psto = pw.getPropertySheetTabOperator("Expert"); 581 582 pw.close(); 585 586 startHTTPServer(); 587 588 checkResult("http://localhost:16384/",3,"<title>Directory Listing for:/</title>",false); 589 } 590 591 593 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(""); 603 String value=tf.getValue(); 604 tf.setValue("/repository/"); 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 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); 626 psto = pw.getPropertySheetTabOperator("Expert"); 627 628 tf=new TextFieldProperty(psto,"Base Filesystems URL"); 629 tf.setValue(""); 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 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); 649 psto = pw.getPropertySheetTabOperator("Expert"); 650 651 tf=new TextFieldProperty(psto,"Base Filesystems URL"); 652 tf.setValue(""); pw.close(); 654 655 startHTTPServer(); 656 657 checkResult("http://localhost:"+originalPort+"/",1,"<HTML><HEAD><TITLE>Filesystems</TITLE></HEAD>",false); 658 } 659 660 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); 670 psto = pw.getPropertySheetTabOperator("Expert"); 671 672 tf=new TextFieldProperty(psto,"Base Filesystems URL"); 673 tf.setValue("newrepository"); pw.close(); 675 676 startHTTPServer(); 677 678 checkResult("http://localhost:"+originalPort+"/newrepository/",1,"<HTML><HEAD><TITLE>Filesystems</TITLE></HEAD>",false); 679 } 680 681 682 684 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"); tf2.setValue("foo1"); 697 AssertionFailedErrorException e = checkDialog("Information"); 698 699 tf1.setValue("repository"); tf2.setValue("classpath"); pw.close(); 702 703 if (e != null) 704 throw e; 705 } 706 707 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(""); 717 AssertionFailedErrorException e = checkDialog("Information"); 718 String value=tf.getValue(); 719 tf.setValue("/classpath/"); 720 pw.close(); 721 722 if (e != null) 723 throw e; 724 725 if (!value.equals("/")) { pw.close(); 727 fail("Invalid 'Base Class Path URL' field value"); 728 } 729 730 731 } 732 733 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); 743 psto = pw.getPropertySheetTabOperator("Expert"); 744 745 tf=new TextFieldProperty(psto,"Base Class Path URL"); 746 tf.setValue(""); 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 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); 771 psto = pw.getPropertySheetTabOperator("Expert"); 772 773 tf=new TextFieldProperty(psto,"Base Class Path URL"); 774 tf.setValue(""); 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 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); 793 psto = pw.getPropertySheetTabOperator("Expert"); 794 795 tf=new TextFieldProperty(psto,"Base Class Path URL"); 796 tf.setValue("newclasspath"); 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 808 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"); tf2.setValue("foo2"); 821 AssertionFailedErrorException e = checkDialog("Information"); 822 823 tf1.setValue("repository"); tf2.setValue("javadoc"); pw.close(); 826 827 if (e != null) { 828 throw e; 829 } 830 } 831 832 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(""); 842 String value=tf.getValue(); 843 AssertionFailedErrorException e = checkDialog("Information"); 844 845 tf.setValue("/javadoc/"); pw.close(); 847 848 if (e != null) { 849 throw e; 850 } 851 852 if (!value.equals("/")) { fail("Invalid 'Base Javadoc URL' field value"); 854 } 855 } 856 857 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); 867 psto = pw.getPropertySheetTabOperator("Expert"); 868 869 tf=new TextFieldProperty(psto,"Base Javadoc URL"); 870 tf.setValue(""); 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 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); 895 psto = pw.getPropertySheetTabOperator("Expert"); 896 897 tf=new TextFieldProperty(psto,"Base Javadoc URL"); 898 tf.setValue(""); pw.close(); 900 901 startHTTPServer(); 902 903 checkResult("http://localhost:"+originalPort+"/",2,"List of Javadoc mounts",false); 904 } 905 906 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); 916 psto = pw.getPropertySheetTabOperator("Expert"); 917 918 tf=new TextFieldProperty(psto,"Base Javadoc URL"); 919 tf.setValue("newjavadoc"); pw.close(); 921 922 startHTTPServer(); 923 924 checkResult("http://localhost:"+originalPort+"/newjavadoc/",2,"List of Javadoc mounts",false); 925 } 926 927 928 930 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 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 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 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 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 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"); 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 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 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 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 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 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 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 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 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 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 ex) { 1147 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 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 pw.close(); 1179 if (e != null) 1180 throw e; 1181 1182 } 1183 1184 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 ex) { 1197 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/"); 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 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 tf.setValue("/testvalue_cp/"); 1230 pw.pushKey(java.awt.event.KeyEvent.VK_TAB); 1231 pw.pushKey(java.awt.event.KeyEvent.VK_TAB); 1232 1241 1242 value=tf.getValue(); 1243 if (!value.equals("/testvalue_cp/")) { pw.close(); 1245 fail("Invalid 'Base Class Path URL' field value ("+value+")"); 1246 } 1247 1248 pw.close(); 1249 } 1250 1251 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/"); tf.openEditor(); 1261 1262 try { 1263 dop=new NbDialogOperator("Base Class Path URL"); 1264 } catch(Exception ex) { 1265 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/")) { 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 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 ex) { 1295 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"); 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/")) { dop.close(); 1309 pw.close(); 1310 fail("Invalid 'Base Class Path URL' field value ("+value+")"); 1311 } 1312 1313 pw.close(); 1314 } 1315 1316 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 pw.close(); 1330 if (e != null) 1331 throw e; 1332 } 1333 1334 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 ex) { 1347 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/"); 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 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 tf.setValue("/testvalue_fs/"); 1381 pw.pushKey(java.awt.event.KeyEvent.VK_TAB); 1382 pw.pushKey(java.awt.event.KeyEvent.VK_TAB); 1383 1392 1393 value=tf.getValue(); 1394 if (!value.equals("/testvalue_fs/")) { pw.close(); 1396 fail("Invalid 'Base Filesystems URL' field value ("+value+")"); 1397 } 1398 1399 pw.close(); 1400 } 1401 1402 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/"); tf.openEditor(); 1412 1413 try { 1414 dop=new NbDialogOperator("Base Filesystems URL"); 1415 } catch(Exception ex) { 1416 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/")) { 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 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 ex) { 1446 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"); 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/")) { dop.close(); 1460 pw.close(); 1461 fail("Invalid 'Base Filesystems URL' field value ("+value+")"); 1462 } 1463 1464 pw.close(); 1465 } 1466 1467 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 pw.close(); 1482 if (e != null) 1483 throw e; 1484 } 1485 1486 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 ex) { 1499 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/"); 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 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 tf.setValue("/testvalue_jd/"); 1533 pw.pushKey(java.awt.event.KeyEvent.VK_TAB); 1534 pw.pushKey(java.awt.event.KeyEvent.VK_TAB); 1535 1544 1545 value=tf.getValue(); 1546 if (!value.equals("/testvalue_jd/")) { pw.close(); 1548 fail("Invalid 'Base Javadoc URL' field value ("+value+")"); 1549 } 1550 1551 pw.close(); 1552 } 1553 1554 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/"); tf.openEditor(); 1564 1565 try { 1566 dop=new NbDialogOperator("Base Javadoc URL"); 1567 } catch(Exception ex) { 1568 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/")) { 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 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 ex) { 1598 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"); 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/")) { dop.close(); 1612 pw.close(); 1613 fail("Invalid 'Base Javadoc URL' field value ("+value+")"); 1614 } 1615 1616 pw.close(); 1617 } 1618 1619 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 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"); 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 1657 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 ex) { 1671 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 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 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 ex) { 1717 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 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 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 ex) { 1762 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 1781 1782 1783 try { 1784 Robot rb=new java.awt.Robot (); 1785 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 AWTException) { 1800 System.out.println("AWTException in test_4_9_3"); } 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 |