001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package gui.propertyeditors;
043:
044: import org.netbeans.jellytools.properties.editors.ServiceTypeCustomEditorOperator;
045:
046: import org.netbeans.junit.NbTestSuite;
047:
048: /**
049: * Tests of Service Type Property Editor.
050: *
051: * @author Marian.Mirilovic@Sun.Com
052: */
053: public class PropertyType_ServiceType extends PropertyEditorsTest {
054:
055: public String propertyName_L;
056: public String propertyValue_L;
057: public String propertyValueExpectation_L;
058:
059: public boolean waitDialog = false;
060:
061: /** Creates a new instance of PropertyType_ServiceType */
062: public PropertyType_ServiceType(String testName) {
063: super (testName);
064: }
065:
066: public void setUp() {
067: propertyName_L = "Service Type";
068: super .setUp();
069: }
070:
071: public static NbTestSuite suite() {
072: NbTestSuite suite = new NbTestSuite();
073: suite.addTest(new PropertyType_ServiceType("testByCombo"));
074: suite.addTest(new PropertyType_ServiceType("verifyCustomizer"));
075: suite.addTest(new PropertyType_ServiceType("testCustomizerOk"));
076: suite.addTest(new PropertyType_ServiceType(
077: "testCustomizerCancel"));
078: return suite;
079: }
080:
081: public void testByCombo() {
082: propertyValue_L = org.netbeans.jellytools.Bundle
083: .getStringTrimmed("org.netbeans.modules.search.Bundle",
084: "Services/SearchType/org-netbeans-modules-search-ObjectTypeType.settings"); // Type
085: propertyValueExpectation_L = propertyValue_L;
086: waitDialog = false;
087: setByCombo(propertyName_L, propertyValue_L, true);
088: }
089:
090: public void testCustomizerOk() {
091: propertyValue_L = org.netbeans.jellytools.Bundle
092: .getStringTrimmed(
093: "org.netbeans.modules.search.types.Bundle",
094: "TEXT_DATE_CRITERION"); // Date
095: propertyValueExpectation_L = propertyValue_L;
096: waitDialog = false;
097: setByCustomizerOk(propertyName_L, true);
098: }
099:
100: public void testCustomizerCancel() {
101: propertyValue_L = org.netbeans.jellytools.Bundle
102: .getStringTrimmed("org.netbeans.modules.search.Bundle",
103: "Services/SearchType/org-netbeans-modules-search-ObjectTypeType.settings"); // Type
104: propertyValueExpectation_L = propertyValue_L;
105: waitDialog = false;
106: setByCustomizerCancel(propertyName_L, false);
107: }
108:
109: public void testCustomizerOk_platform() {
110: propertyValue_L = org.netbeans.jellytools.Bundle
111: .getStringTrimmed(
112: "org.netbeans.modules.autoupdate.resources.Bundle",
113: "Services/AutoupdateType/autoupdate_xml_type_1.settings"); // NetBeans Update Center Beta
114: propertyValueExpectation_L = propertyValue_L;
115: waitDialog = false;
116: setByCustomizerOk(propertyName_L, true);
117: }
118:
119: public void testCustomizerCancel_platform() {
120: propertyValue_L = org.netbeans.jellytools.Bundle
121: .getStringTrimmed(
122: "org.netbeans.modules.autoupdate.resources.Bundle",
123: "Services/AutoupdateType/autoupdate_xml_type.settings"); // NetBeans Update Center
124: propertyValueExpectation_L = propertyValue_L;
125: waitDialog = false;
126: setByCustomizerCancel(propertyName_L, false);
127: }
128:
129: public void verifyCustomizer() {
130: verifyCustomizer(propertyName_L);
131: }
132:
133: public void setCustomizerValue() {
134: ServiceTypeCustomEditorOperator customizer = new ServiceTypeCustomEditorOperator(
135: propertyCustomizer);
136: customizer.setServiceTypeValue(propertyValue_L);
137: }
138:
139: public void verifyPropertyValue(boolean expectation) {
140: verifyExpectationValue(propertyName_L, expectation,
141: propertyValueExpectation_L, propertyValue_L, waitDialog);
142: }
143:
144: public void verifyCustomizerLayout() {
145: ServiceTypeCustomEditorOperator customizer = new ServiceTypeCustomEditorOperator(
146: propertyCustomizer);
147: customizer.lstServices();
148: customizer.propertySheet();
149: customizer.btOK();
150: customizer.btCancel();
151: }
152:
153: /** Test could be executed internaly in Forte without XTest
154: * @param args arguments from command line
155: */
156: public static void main(String[] args) {
157: //junit.textui.TestRunner.run(new NbTestSuite(PropertyType_ServiceType.class));
158: junit.textui.TestRunner.run(suite());
159: }
160:
161: }
|