KickJava   Java API By Example, From Geeks To Geeks.

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


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  * CreatingPropertiesFileFromExplorer2.java
22  *
23  * This is autometed test for netBeans version 40.
24  *
25  * Created on 19. brezen 2002, 11:07
26  *
27  */

28
29 package org.netbeans.properties.jelly2tests.suites.creating_properties_file;
30
31 import org.netbeans.jellytools.*;
32 import lib.PropertiesEditorTestCase;
33 import org.netbeans.jellytools.nodes.Node;
34 import org.netbeans.jellytools.nodes.SourcePackagesNode;
35
36
37 /**
38  *
39  * @author Petr Felenda - QA Engineer
40  */

41 public class CreatingPropertiesFileFromExplorer2 extends PropertiesEditorTestCase {
42
43     /*
44      * Definition of member variables and objects
45      */

46     final String JavaDoc PACKAGE_PATH = "examples";
47     final String JavaDoc FILE_NAME = "testFileExplorer2";
48     
49     
50     /**
51      * Constructor - Creates a new instance of CreatingPropertiesFileFromExplorer2
52      */

53     public CreatingPropertiesFileFromExplorer2() {
54         super("testCreatingPropertiesFileFromExplorer2");
55     }
56     
57     
58     /**
59      * This method contain body of test
60      * @return void
61      */

62     public void testCreatingPropertiesFileFromExplorer2() {
63         
64         
65         // open project
66
openDefaultProject();
67         
68         /*
69          * 1st step of testcase
70          * In explorer create new properties file. Right click on any directory and
71          * select in appeared context menu New|Other|Properties File.
72          */

73         Node node = new Node(new SourcePackagesNode(defaultProjectName),PACKAGE_PATH);
74         node.select();
75         node.callPopup().pushMenuNoBlock("New"+menuSeparator+"File/Folder...",menuSeparator);
76         NewFileWizardOperator newWizard = new NewFileWizardOperator();
77         newWizard.selectCategory(WIZARD_CATEGORY_FILE);
78         newWizard.selectFileType(WIZARD_FILE_TYPE);
79         newWizard.next();
80         //type class name
81
NewFileNameLocationStepOperator nfnlso = new NewFileNameLocationStepOperator();
82         nfnlso.setObjectName(FILE_NAME);
83         //push finish
84
newWizard.finish();
85         
86        
87         /*
88          * 2nd step of testcase
89          * In explorer create new properties file. Right click on any directory and select
90          * in appeared context menu New|Other|Properties File
91          */

92         node.select();
93         node.callPopup().pushMenuNoBlock("New"+menuSeparator+"File/Folder...",menuSeparator);
94         newWizard = new NewFileWizardOperator();
95         newWizard.selectCategory(WIZARD_CATEGORY_FILE);
96         newWizard.selectFileType(WIZARD_FILE_TYPE);
97         newWizard.next();
98         
99         /*
100          * 3th step of testcase
101          * Type name to appeared wizard.(as same name as previous case)
102          */

103         nfnlso = new NewFileNameLocationStepOperator();
104         nfnlso.setObjectName(FILE_NAME);
105         
106         
107         /*
108          * 4th step of testcase - Result
109          * Try confirm wizard. 'Finish' button should be disabled.
110          */

111         if ( nfnlso.btFinish().isEnabled() == true )
112             fail("Button finish is enabled and should be disabled.Because file with this name exist.");
113         else
114             log("Button is disabled. (Ok)");
115         
116         
117         /*
118          * 5th step of testcase
119          * Cancel wizard. Click to 'Cancel' button.
120          */

121         nfnlso.btCancel().push();
122         
123     }
124     
125     public void tearDown() {
126         log("Teardown");
127         closeFiles();
128     }
129     
130     
131     
132 }
133
Popular Tags