KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > gui > web > extbrowser > settings > SystemSettings


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.web.extbrowser.settings;
21
22 import org.netbeans.jellytools.JellyTestCase;
23 import org.netbeans.jellytools.Bundle;
24 import org.netbeans.jellytools.ExplorerOperator;
25 import org.netbeans.jellytools.OptionsOperator;
26 import org.netbeans.jellytools.NbDialogOperator;
27
28 import org.netbeans.jellytools.properties.ComboBoxProperty;
29 import org.netbeans.jellytools.properties.PropertySheetTabOperator;
30 import org.netbeans.jellytools.properties.PropertySheetOperator;
31 import org.netbeans.jellytools.properties.editors.FileCustomEditorOperator;
32
33
34
35
36 import org.netbeans.test.gui.web.util.BrowserUtils;
37
38 import org.netbeans.jemmy.operators.JButtonOperator;
39 import org.netbeans.jemmy.operators.JTextFieldOperator;
40 import org.netbeans.jemmy.operators.JTextComponentOperator;
41 import org.netbeans.junit.NbTestSuite;
42 import java.io.File JavaDoc;
43
44 public class SystemSettings extends JellyTestCase {
45     private static String JavaDoc fSep = System.getProperty("file.separator");
46     private static String JavaDoc iSep = "|";
47    
48
49     public SystemSettings(java.lang.String JavaDoc testName) {
50         super(testName);
51     }
52
53     public static void main(java.lang.String JavaDoc[] args) {
54         junit.textui.TestRunner.run(suite());
55     }
56          
57     //method required by JUnit
58
public static junit.framework.Test suite() {
59     return new NbTestSuite(SystemSettings.class);
60     }
61
62     /**
63        System settings : External Browser(Unix)
64      **/

65     public void testEBU() {
66     String JavaDoc newVal = Bundle.getString("org.netbeans.modules.extbrowser.Bundle" ,"Services/Browsers/UnixWebBrowser.settings");
67     testSystemValue(newVal);
68     }
69
70     /**
71        System settings : External Browser(Command Line)
72     **/

73     public void testEBCL() {
74     String JavaDoc newVal = Bundle.getString("org.netbeans.modules.extbrowser.Bundle" ,"Services/Browsers/SimpleExtBrowser.settings");
75     testSystemValue(newVal);
76     }
77
78     /**
79        System settings : Swing HTML Browser
80     **/

81     public void testSwing() {
82     String JavaDoc newVal = Bundle.getString("org.netbeans.core.ui.Bundle" ,"Services/Browsers/SwingBrowser.ser");
83     testSystemValue(newVal);
84     }
85
86
87     private void testSystemValue(String JavaDoc newVal) {
88     OptionsOperator oo = OptionsOperator.invoke();
89     String JavaDoc ideConfiguration = Bundle.getString("org.netbeans.core.Bundle", "UI/Services/IDEConfiguration");
90     String JavaDoc sys = Bundle.getString("org.netbeans.core.Bundle", "UI/Services/IDEConfiguration/System");
91     String JavaDoc sett = Bundle.getString("org.netbeans.core.Bundle","Services/org-netbeans-core-IDESettings.settings");
92     oo.selectOption(ideConfiguration + iSep + sys + iSep + sett);
93     PropertySheetOperator pso = PropertySheetOperator.invoke();
94         PropertySheetTabOperator psto = new PropertySheetTabOperator(pso);
95     String JavaDoc pnameWebBrowser = Bundle.getString("org.netbeans.modules.web.core.Bundle" ,"PROP_WWWBrowser");
96     ComboBoxProperty pr = new ComboBoxProperty(psto, pnameWebBrowser);
97     pr.setValue(newVal);
98     if (!pr.getValue().equals(newVal)) {
99         fail("Web Browser is not changed");
100     }
101     oo.close();
102     oo = OptionsOperator.invoke();
103     oo.selectOption(ideConfiguration + iSep + sys + iSep + sett);
104     pso = PropertySheetOperator.invoke();
105         psto = new PropertySheetTabOperator(pso);
106     pr = new ComboBoxProperty(psto, pnameWebBrowser);
107     if (!pr.getValue().equals(newVal)) {
108         fail("Web Browser property not saved");
109     }
110     }
111 }
112
113
114
115
116
117
118
119
120
Popular Tags