001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: /*
043: * CreatingPropertiesFileFromMainWindow1.java
044: *
045: * This is autometed test for netBeans version 40.
046: *
047: * 1. Open New Wizard. Use menu File|New ... from main window.
048: * 2. Select from wizard Templates|Other|Properties File and click Next button.
049: * 3. There is set default file name and package name. Do not change these values.
050: * 4. Confirm wizard.
051: * 5. Wait to properties file appeared in Explorer.
052: * RESULT: New properties file will be add (with default name - properties.properties) to adequate place in Explorer and opened in editor.
053: *
054: * Created on 16. September 2002
055: */
056:
057: package org.netbeans.properties.jelly2tests.suites.creating_properties_file;
058:
059: import org.netbeans.jellytools.*;
060: import org.netbeans.jemmy.QueueTool;
061: import lib.PropertiesEditorTestCase;
062: import org.netbeans.jemmy.EventTool;
063: import org.netbeans.jemmy.TimeoutExpiredException;
064: import org.netbeans.jemmy.operators.JTextFieldOperator;
065:
066: /**
067: *
068: * @author Petr Felenda - QA Engineer ( petr.felenda@sun.com )
069: */
070: public class CreatingPropertiesFileFromMainWindow1 extends
071: PropertiesEditorTestCase {
072:
073: /*
074: * Definition of member variables
075: */
076:
077: /**
078: * Constructor - Creates a new instance of this class
079: */
080: public CreatingPropertiesFileFromMainWindow1() {
081: super ("testCreatingPropertiesFileFromMainWindow1");
082: }
083:
084: /**
085: * This method contains body of test
086: * @return void
087: */
088: public void testCreatingPropertiesFileFromMainWindow1() {
089:
090: // open project
091: openDefaultProject();
092:
093: /*
094: * 1st step of testcase ( here is used toolbar's icon for opening wizard )
095: * There will be opened New Wizard from Main Window Toolbar ( icon 'New' from toolbar 'System' )
096: */
097:
098: MainWindowOperator mainWindowOp = MainWindowOperator
099: .getDefault();
100: mainWindowOp.menuBar().pushMenuNoBlock(
101: "File" + menuSeparator + "New File...", menuSeparator);
102:
103: /*
104: * 2nd step of testcase
105: * Select from wizard Other|Properties File and click next button.
106: */
107: NewFileWizardOperator newWizard = new NewFileWizardOperator();
108: newWizard.selectCategory(WIZARD_CATEGORY_FILE);
109: newWizard.selectFileType(WIZARD_FILE_TYPE);
110: newWizard.next();
111:
112: /*
113: * 3rd step of testcase
114: * (here is nothing happen)
115: * There is set default name and package. Do not change these values
116: * ( package must be added because autotemed tests add jars and mount file-
117: * systems witch are don't have deterministic order
118: */
119: // it must be selected a Folder to place the file ( is this a bug ? )
120: NewFileNameLocationStepOperator nameStepOper = new NewFileNameLocationStepOperator();
121: JTextFieldOperator jtfo = new JTextFieldOperator(nameStepOper,
122: 2);
123: jtfo.setText("src");
124:
125: /*
126: * 4th step of testcase
127: * Confirm wizard
128: */
129: newWizard.finish();
130:
131: /*
132: * Result
133: * Should be added new properties file (with default name) to adequate place in
134: * explorer and opened in editor.
135: */
136: if (!existsFileInEditor(WIZARD_DEFAULT_PROPERTIES_FILE_NAME))
137: fail("File " + WIZARD_DEFAULT_PROPERTIES_FILE_NAME
138: + " not found in Editor window");
139: if (!existsFileInExplorer("<default package>",
140: WIZARD_DEFAULT_PROPERTIES_FILE_NAME + ".properties"))
141: fail("File " + WIZARD_DEFAULT_PROPERTIES_FILE_NAME
142: + " not found in explorer");
143:
144: }
145:
146: public void tearDown() {
147: log("Teardown");
148: closeFiles();
149: }
150:
151: }
|