KickJava   Java API By Example, From Geeks To Geeks.

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


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  * CreatingPropertiesFileFromMainWindow1.java
22  *
23  * This is autometed test for netBeans version 40.
24  *
25  * 1. Open New Wizard. Use menu File|New ... from main window.
26  * 2. Select from wizard Templates|Other|Properties File and click Next button.
27  * 3. There is set default file name and package name. Do not change these values.
28  * 4. Confirm wizard.
29  * 5. Wait to properties file appeared in Explorer.
30  * RESULT: New properties file will be add (with default name - properties.properties) to adequate place in Explorer and opened in editor.
31  *
32  * Created on 16. September 2002
33  */

34
35 package org.netbeans.properties.jelly2tests.suites.creating_properties_file;
36
37 import org.netbeans.jellytools.*;
38 import org.netbeans.jemmy.QueueTool;
39 import lib.PropertiesEditorTestCase;
40 import org.netbeans.jemmy.EventTool;
41 import org.netbeans.jemmy.TimeoutExpiredException;
42 import org.netbeans.jemmy.operators.JTextFieldOperator;
43
44
45 /**
46  *
47  * @author Petr Felenda - QA Engineer ( petr.felenda@sun.com )
48  */

49 public class CreatingPropertiesFileFromMainWindow1 extends PropertiesEditorTestCase {
50     
51     /*
52      * Definition of member variables
53      */

54     
55     
56     
57     /**
58      * Constructor - Creates a new instance of this class
59      */

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

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

78         
79         MainWindowOperator mainWindowOp = MainWindowOperator.getDefault();
80         mainWindowOp.menuBar().pushMenuNoBlock("File"+menuSeparator+"New File...",menuSeparator);
81         
82         /*
83          * 2nd step of testcase
84          * Select from wizard Other|Properties File and click next button.
85          */

86         NewFileWizardOperator newWizard = new NewFileWizardOperator();
87         newWizard.selectCategory(WIZARD_CATEGORY_FILE);
88         newWizard.selectFileType(WIZARD_FILE_TYPE);
89         newWizard.next();
90         
91         
92         /*
93          * 3rd step of testcase
94          * (here is nothing happen)
95          * There is set default name and package. Do not change these values
96          * ( package must be added because autotemed tests add jars and mount file-
97          * systems witch are don't have deterministic order
98          */

99         // it must be selected a Folder to place the file ( is this a bug ? )
100
NewFileNameLocationStepOperator nameStepOper = new NewFileNameLocationStepOperator();
101         JTextFieldOperator jtfo = new JTextFieldOperator(nameStepOper,2);
102         jtfo.setText("src");
103         
104         /*
105          * 4th step of testcase
106          * Confirm wizard
107          */

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

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