KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > propertyeditors > PropertyType_ServiceType


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 gui.propertyeditors;
21
22 import org.netbeans.jellytools.properties.editors.ServiceTypeCustomEditorOperator;
23
24 import org.netbeans.junit.NbTestSuite;
25
26 /**
27  * Tests of Service Type Property Editor.
28  *
29  * @author Marian.Mirilovic@Sun.Com
30  */

31 public class PropertyType_ServiceType extends PropertyEditorsTest {
32
33     public String JavaDoc propertyName_L;
34     public String JavaDoc propertyValue_L;
35     public String JavaDoc propertyValueExpectation_L;
36
37     public boolean waitDialog = false;
38
39     /** Creates a new instance of PropertyType_ServiceType */
40     public PropertyType_ServiceType(String JavaDoc testName) {
41         super(testName);
42     }
43     
44     
45     public void setUp(){
46         propertyName_L = "Service Type";
47         super.setUp();
48     }
49     
50     public static NbTestSuite suite() {
51         NbTestSuite suite = new NbTestSuite();
52         suite.addTest(new PropertyType_ServiceType("testByCombo"));
53         suite.addTest(new PropertyType_ServiceType("verifyCustomizer"));
54         suite.addTest(new PropertyType_ServiceType("testCustomizerOk"));
55         suite.addTest(new PropertyType_ServiceType("testCustomizerCancel"));
56         return suite;
57     }
58     
59     public void testByCombo(){
60         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "Services/SearchType/org-netbeans-modules-search-ObjectTypeType.settings"); // Type
61
propertyValueExpectation_L = propertyValue_L;
62         waitDialog = false;
63         setByCombo(propertyName_L, propertyValue_L, true);
64     }
65     
66     public void testCustomizerOk(){
67         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.modules.search.types.Bundle", "TEXT_DATE_CRITERION"); // Date
68
propertyValueExpectation_L = propertyValue_L;
69         waitDialog = false;
70         setByCustomizerOk(propertyName_L, true);
71     }
72     
73     public void testCustomizerCancel(){
74         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.modules.search.Bundle", "Services/SearchType/org-netbeans-modules-search-ObjectTypeType.settings"); // Type
75
propertyValueExpectation_L = propertyValue_L;
76         waitDialog = false;
77         setByCustomizerCancel(propertyName_L, false);
78     }
79     
80     public void testCustomizerOk_platform(){
81         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.modules.autoupdate.resources.Bundle", "Services/AutoupdateType/autoupdate_xml_type_1.settings"); // NetBeans Update Center Beta
82
propertyValueExpectation_L = propertyValue_L;
83         waitDialog = false;
84         setByCustomizerOk(propertyName_L, true);
85     }
86     
87     public void testCustomizerCancel_platform(){
88         propertyValue_L = org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.modules.autoupdate.resources.Bundle", "Services/AutoupdateType/autoupdate_xml_type.settings"); // NetBeans Update Center
89
propertyValueExpectation_L = propertyValue_L;
90         waitDialog = false;
91         setByCustomizerCancel(propertyName_L, false);
92     }
93     
94     public void verifyCustomizer() {
95         verifyCustomizer(propertyName_L);
96     }
97     
98     public void setCustomizerValue() {
99         ServiceTypeCustomEditorOperator customizer = new ServiceTypeCustomEditorOperator(propertyCustomizer);
100         customizer.setServiceTypeValue(propertyValue_L);
101     }
102     
103     public void verifyPropertyValue(boolean expectation) {
104         verifyExpectationValue(propertyName_L,expectation, propertyValueExpectation_L, propertyValue_L, waitDialog);
105     }
106     
107     public void verifyCustomizerLayout() {
108         ServiceTypeCustomEditorOperator customizer = new ServiceTypeCustomEditorOperator(propertyCustomizer);
109         customizer.lstServices();
110         customizer.propertySheet();
111         customizer.btOK();
112         customizer.btCancel();
113     }
114     
115     /** Test could be executed internaly in Forte without XTest
116      * @param args arguments from command line
117      */

118     public static void main(String JavaDoc[] args) {
119         //junit.textui.TestRunner.run(new NbTestSuite(PropertyType_ServiceType.class));
120
junit.textui.TestRunner.run(suite());
121     }
122     
123 }
124
Popular Tags