KickJava   Java API By Example, From Geeks To Geeks.

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


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  * File CreatingPropertiesFileFromExplorer1.java
22  *
23  * This is autometed test for netBeans version 40.
24  *
25  * Created on 16. September 2002
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
35 import org.netbeans.jellytools.nodes.SourcePackagesNode;
36
37
38 /**
39  *
40  * @author Petr Felenda - QA Engineer ( petr.felenda@sun.com )
41  */

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

47     final String JavaDoc FILE_NAME = "testFileExplorer1" ;
48     final String JavaDoc PACKAGE_PATH = "samples";
49     
50     
51     
52     /**
53      * Constructor - creates a new instance of CreatingPropertiesFileFromExplorer1
54      */

55     public CreatingPropertiesFileFromExplorer1() {
56         super("testCreatingPropertiesFileFromExplorer1");
57     }
58     
59     /**
60      * This method contain body of test
61      * @return void
62      */

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

74         log(PACKAGE_PATH);
75         SourcePackagesNode spn = new SourcePackagesNode(defaultProjectName);
76         Node node = new Node(spn,PACKAGE_PATH);
77         
78         node.select();
79         node.callPopup().pushMenuNoBlock("New"+menuSeparator+"File/Folder...",menuSeparator);
80         NewFileWizardOperator newWizard = new NewFileWizardOperator();
81         newWizard.selectCategory(WIZARD_CATEGORY_FILE);
82         newWizard.selectFileType(WIZARD_FILE_TYPE);
83         newWizard.next();
84         
85         /*
86          * 2nd step of testcase
87          * Type name to appeared wizard.
88          */

89         NewFileNameLocationStepOperator nameStepOper = new NewFileNameLocationStepOperator();
90         nameStepOper.setObjectName(FILE_NAME);
91         
92         
93         /*
94          * 3rd step of testcase
95          * Confirm wizard. Press Finish button.
96          */

97         newWizard.finish();
98         
99         /*
100          * Result
101          * Should be created new file in explorer and opened in editor.
102          */

103         if ( ! existsFileInEditor(FILE_NAME) )
104             fail("File "+ FILE_NAME +" not found in Editor window");
105         if ( ! existsFileInExplorer("samples",FILE_NAME) )
106             fail("File "+ FILE_NAME +" not found in explorer");
107     }
108     
109     public void tearDown() {
110         log("Teardown");
111         closeFiles();
112     }
113     
114     
115     
116     
117 }
118
Popular Tags