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: * CreatingPropertiesFileFromExplorer2.java
044: *
045: * This is autometed test for netBeans version 40.
046: *
047: * Created on 19. brezen 2002, 11:07
048: *
049: */
050:
051: package org.netbeans.properties.jelly2tests.suites.creating_properties_file;
052:
053: import org.netbeans.jellytools.*;
054: import lib.PropertiesEditorTestCase;
055: import org.netbeans.jellytools.nodes.Node;
056: import org.netbeans.jellytools.nodes.SourcePackagesNode;
057:
058: /**
059: *
060: * @author Petr Felenda - QA Engineer
061: */
062: public class CreatingPropertiesFileFromExplorer2 extends
063: PropertiesEditorTestCase {
064:
065: /*
066: * Definition of member variables and objects
067: */
068: final String PACKAGE_PATH = "examples";
069: final String FILE_NAME = "testFileExplorer2";
070:
071: /**
072: * Constructor - Creates a new instance of CreatingPropertiesFileFromExplorer2
073: */
074: public CreatingPropertiesFileFromExplorer2() {
075: super ("testCreatingPropertiesFileFromExplorer2");
076: }
077:
078: /**
079: * This method contain body of test
080: * @return void
081: */
082: public void testCreatingPropertiesFileFromExplorer2() {
083:
084: // open project
085: openDefaultProject();
086:
087: /*
088: * 1st step of testcase
089: * In explorer create new properties file. Right click on any directory and
090: * select in appeared context menu New|Other|Properties File.
091: */
092: Node node = new Node(
093: new SourcePackagesNode(defaultProjectName),
094: PACKAGE_PATH);
095: node.select();
096: node.callPopup().pushMenuNoBlock(
097: "New" + menuSeparator + "Other...", menuSeparator);
098: NewFileWizardOperator newWizard = new NewFileWizardOperator();
099: newWizard.selectCategory(WIZARD_CATEGORY_FILE);
100: newWizard.selectFileType(WIZARD_FILE_TYPE);
101: newWizard.next();
102: //type class name
103: NewFileNameLocationStepOperator nfnlso = new NewFileNameLocationStepOperator();
104: nfnlso.setObjectName(FILE_NAME);
105: //push finish
106: newWizard.finish();
107:
108: /*
109: * 2nd step of testcase
110: * In explorer create new properties file. Right click on any directory and select
111: * in appeared context menu New|Other|Properties File
112: */
113: node.select();
114: node.callPopup().pushMenuNoBlock(
115: "New" + menuSeparator + "Other...", menuSeparator);
116: newWizard = new NewFileWizardOperator();
117: newWizard.selectCategory(WIZARD_CATEGORY_FILE);
118: newWizard.selectFileType(WIZARD_FILE_TYPE);
119: newWizard.next();
120:
121: /*
122: * 3th step of testcase
123: * Type name to appeared wizard.(as same name as previous case)
124: */
125: nfnlso = new NewFileNameLocationStepOperator();
126: nfnlso.setObjectName(FILE_NAME);
127:
128: /*
129: * 4th step of testcase - Result
130: * Try confirm wizard. 'Finish' button should be disabled.
131: */
132: if (nfnlso.btFinish().isEnabled() == true)
133: fail("Button finish is enabled and should be disabled.Because file with this name exist.");
134: else
135: log("Button is disabled. (Ok)");
136:
137: /*
138: * 5th step of testcase
139: * Cancel wizard. Click to 'Cancel' button.
140: */
141: nfnlso.btCancel().push();
142:
143: }
144:
145: public void tearDown() {
146: log("Teardown");
147: closeFiles();
148: }
149:
150: }
|