KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > properties > jelly2tests > suites > creating_properties_file > CreatingPropertiesFileFromMainWindow2


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 /*
21  * CreatingPropertiesFileFromMainWindow2.java
22  *
23  * This is autometed test for netBeans version 40.
24  *
25  * Created on 18. September 2002
26  */

27
28 package org.netbeans.properties.jelly2tests.suites.creating_properties_file;
29
30 import java.awt.Component JavaDoc;
31 import java.awt.Container JavaDoc;
32 import java.io.File JavaDoc;
33 import junit.textui.TestRunner;
34 import lib.PropertiesEditorTestCase;
35 import org.netbeans.jellytools.*;
36 import org.netbeans.jellytools.nodes.PropertiesNode;
37 import org.netbeans.jemmy.EventTool;
38 import org.netbeans.jemmy.operators.JTextFieldOperator;
39 import org.netbeans.jemmy.operators.JTreeOperator;
40 import org.netbeans.junit.NbTestSuite;
41
42
43 /**
44  *
45  * @author Petr Felenda - QA Engineer (petr.felenda@sun.com)
46  */

47 public class CreatingPropertiesFileFromMainWindow2 extends PropertiesEditorTestCase {
48     
49     /*
50      * Definition of member variables and objects
51      */

52     final String JavaDoc FILE_NAME = "testPropertiesFile" ;
53     
54     
55     
56     
57     /**
58      * Constructor - Creates a new instance of this class
59      */

60     public CreatingPropertiesFileFromMainWindow2() {
61         super("testCreatingPropertiesFileFromMainWindow2");
62     }
63     
64     
65     /**
66      * This method contain body of test
67      * @return void
68      */

69     public void testCreatingPropertiesFileFromMainWindow2() {
70         
71         // open project
72
openProject("properties_test2");
73         openDefaultProject();
74         
75         
76         /*
77          * 1st step of testcase ( here is used toolbar's icon for opening wizard )
78          * There will be opened New Wizard from Main Window Toolbar ( icon 'New File...' from toolbar 'System' )
79          */

80         MainWindowOperator mainWindowOp = MainWindowOperator.getDefault();
81         mainWindowOp.getToolbarButton(mainWindowOp.getToolbar("File"),"New File...").pushNoBlock();
82         
83         
84         /*
85          * 2nd step of testcase
86          * Select from wizard Other|Properties File and click next button.
87          */

88         NewFileWizardOperator nwo = new NewFileWizardOperator();
89         nwo.selectCategory(WIZARD_CATEGORY_FILE);
90         nwo.selectFileType(WIZARD_FILE_TYPE);
91         nwo.selectProject("properties_test2");
92         nwo.next();
93         
94         /*
95          * 3rd step of testcase
96          * Type name and select directory.
97          */

98         NewFileNameLocationStepOperator nfnlsp = new NewFileNameLocationStepOperator();
99         nfnlsp.setObjectName(FILE_NAME);
100         JTextFieldOperator jtfo = new JTextFieldOperator(nfnlsp,2);
101         jtfo.setText("src"+File.separator+"examples");
102
103         
104        
105         /*
106          * 4th step of testcase
107          * Confirm wizard
108          */

109         nfnlsp.finish();
110         
111         
112         /*
113          * Result
114          * Should be added new properties file to adequate place in explorer and opened in editor
115          */

116         if ( ! existsFileInEditor(FILE_NAME) )
117             fail("File "+ FILE_NAME +" not found in Editor window");
118         if ( ! existsFileInExplorer("examples",FILE_NAME) )
119             fail("File "+ FILE_NAME +" not found in explorer");
120
121         
122     }
123     
124     public void tearDown() {
125         log("Teardown");
126         closeFiles();
127     }
128 }
129
130
131
132
133
Popular Tags