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 gui.propertyeditors.utilities.CoreSupport;
045:
046: import org.netbeans.jellytools.properties.editors.ProcessDescriptorCustomEditorOperator;
047:
048: import org.netbeans.junit.NbTestSuite;
049:
050: /**
051: * Tests of NbProcessDescriptor Property Editor.
052: *
053: * @author Marian.Mirilovic@Sun.Com
054: */
055: public class PropertyType_NbProcessDescriptor extends
056: PropertyEditorsTest {
057:
058: public String propertyName_L;
059: public String propertyValue_L;
060: public String propertyValueExpectation_L;
061:
062: public boolean waitDialog = false;
063:
064: private String DELIM = ";";
065:
066: private static String FS_Data_path;
067:
068: /** Creates a new instance of PropertyType_NbProcessDescriptor */
069: public PropertyType_NbProcessDescriptor(String testName) {
070: super (testName);
071: }
072:
073: public void setUp() {
074: propertyName_L = "NbProcessDescriptor";
075: super .setUp();
076: }
077:
078: public static NbTestSuite suite() {
079:
080: //TODO write new way for promoD
081: //String path = CoreSupport.getSystemPath("gui/data", CoreSupport.beanName, "java");
082: String path = "";
083:
084: FS_Data_path = path.substring(0, path.lastIndexOf(System
085: .getProperty("file.separator")));
086:
087: NbTestSuite suite = new NbTestSuite();
088: suite.addTest(new PropertyType_NbProcessDescriptor(
089: "testByInPlace"));
090: suite.addTest(new PropertyType_NbProcessDescriptor(
091: "verifyCustomizer"));
092: suite.addTest(new PropertyType_NbProcessDescriptor(
093: "testCustomizerCancel"));
094: suite.addTest(new PropertyType_NbProcessDescriptor(
095: "testCustomizerOk"));
096: return suite;
097: }
098:
099: public void testCustomizerOk() {
100: propertyValue_L = FS_Data_path + DELIM + "okArgument";
101: propertyValueExpectation_L = FS_Data_path + " okArgument";
102: waitDialog = false;
103: setByCustomizerOk(propertyName_L, true);
104: }
105:
106: public void testCustomizerCancel() {
107: propertyValue_L = "cancel" + DELIM + "cancel_argument";
108: propertyValueExpectation_L = propertyValue_L;
109: waitDialog = false;
110: setByCustomizerCancel(propertyName_L, false);
111: }
112:
113: public void testByInPlace() {
114: propertyValue_L = "process argument";
115: propertyValueExpectation_L = propertyValue_L;
116: waitDialog = false;
117: setByInPlace(propertyName_L, propertyValue_L, true);
118: }
119:
120: public void verifyCustomizer() {
121: verifyCustomizer(propertyName_L);
122: }
123:
124: public void setCustomizerValue() {
125: ProcessDescriptorCustomEditorOperator customizer = new ProcessDescriptorCustomEditorOperator(
126: propertyCustomizer);
127:
128: int index = propertyValue_L.indexOf(DELIM);
129: String process = propertyValue_L.substring(0, index);
130: String argument = propertyValue_L.substring(index
131: + DELIM.length());
132:
133: customizer.setProcess(process);
134: customizer.setArguments(argument);
135:
136: }
137:
138: public void verifyPropertyValue(boolean expectation) {
139: verifyExpectationValue(propertyName_L, expectation,
140: propertyValueExpectation_L, propertyValue_L, waitDialog);
141: }
142:
143: public void verifyCustomizerLayout() {
144: ProcessDescriptorCustomEditorOperator customizer = new ProcessDescriptorCustomEditorOperator(
145: propertyCustomizer);
146: customizer.verify();
147: customizer.btOK();
148: customizer.btCancel();
149: }
150:
151: /** Test could be executed internaly in Forte without XTest
152: * @param args arguments from command line
153: */
154: public static void main(String[] args) {
155: //junit.textui.TestRunner.run(new NbTestSuite(PropertyType_NbProcessDescriptor.class));
156: junit.textui.TestRunner.run(suite());
157: }
158:
159: }
|