KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > propertyeditors > PropertyType_NbProcessDescriptor


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 gui.propertyeditors.utilities.CoreSupport;
23
24 import org.netbeans.jellytools.properties.editors.ProcessDescriptorCustomEditorOperator;
25
26 import org.netbeans.junit.NbTestSuite;
27
28 /**
29  * Tests of NbProcessDescriptor Property Editor.
30  *
31  * @author Marian.Mirilovic@Sun.Com
32  */

33 public class PropertyType_NbProcessDescriptor extends PropertyEditorsTest {
34
35     public String JavaDoc propertyName_L;
36     public String JavaDoc propertyValue_L;
37     public String JavaDoc propertyValueExpectation_L;
38
39     public boolean waitDialog = false;
40
41     private String JavaDoc DELIM = ";";
42     
43     private static String JavaDoc FS_Data_path;
44     
45     /** Creates a new instance of PropertyType_NbProcessDescriptor */
46     public PropertyType_NbProcessDescriptor(String JavaDoc testName) {
47         super(testName);
48     }
49     
50     
51     public void setUp(){
52         propertyName_L = "NbProcessDescriptor";
53         super.setUp();
54     }
55     
56     public static NbTestSuite suite() {
57         
58         //TODO write new way for promoD
59
//String path = CoreSupport.getSystemPath("gui/data", CoreSupport.beanName, "java");
60
String JavaDoc path = "";
61         
62         FS_Data_path = path.substring(0,path.lastIndexOf(System.getProperty("file.separator")));
63         
64         NbTestSuite suite = new NbTestSuite();
65         suite.addTest(new PropertyType_NbProcessDescriptor("testByInPlace"));
66         suite.addTest(new PropertyType_NbProcessDescriptor("verifyCustomizer"));
67         suite.addTest(new PropertyType_NbProcessDescriptor("testCustomizerCancel"));
68         suite.addTest(new PropertyType_NbProcessDescriptor("testCustomizerOk"));
69         return suite;
70     }
71     
72     
73     public void testCustomizerOk() {
74         propertyValue_L = FS_Data_path + DELIM + "okArgument";
75         propertyValueExpectation_L = FS_Data_path + " okArgument";
76         waitDialog = false;
77         setByCustomizerOk(propertyName_L, true);
78     }
79     
80     public void testCustomizerCancel(){
81         propertyValue_L = "cancel" + DELIM + "cancel_argument";
82         propertyValueExpectation_L = propertyValue_L;
83         waitDialog = false;
84         setByCustomizerCancel(propertyName_L, false);
85     }
86     
87     public void testByInPlace(){
88         propertyValue_L = "process argument";
89         propertyValueExpectation_L = propertyValue_L;
90         waitDialog = false;
91         setByInPlace(propertyName_L, propertyValue_L, true);
92     }
93     
94     public void verifyCustomizer() {
95         verifyCustomizer(propertyName_L);
96     }
97     
98     public void setCustomizerValue() {
99         ProcessDescriptorCustomEditorOperator customizer = new ProcessDescriptorCustomEditorOperator(propertyCustomizer);
100         
101         int index = propertyValue_L.indexOf(DELIM);
102         String JavaDoc process = propertyValue_L.substring(0,index);
103         String JavaDoc argument = propertyValue_L.substring(index + DELIM.length());
104         
105         customizer.setProcess(process);
106         customizer.setArguments(argument);
107         
108     }
109     
110     public void verifyPropertyValue(boolean expectation) {
111         verifyExpectationValue(propertyName_L,expectation, propertyValueExpectation_L, propertyValue_L, waitDialog);
112     }
113     
114     public void verifyCustomizerLayout() {
115         ProcessDescriptorCustomEditorOperator customizer = new ProcessDescriptorCustomEditorOperator(propertyCustomizer);
116         customizer.verify();
117         customizer.btOK();
118         customizer.btCancel();
119     }
120     
121     /** Test could be executed internaly in Forte without XTest
122      * @param args arguments from command line
123      */

124     public static void main(String JavaDoc[] args) {
125         //junit.textui.TestRunner.run(new NbTestSuite(PropertyType_NbProcessDescriptor.class));
126
junit.textui.TestRunner.run(suite());
127     }
128     
129 }
130
Popular Tags