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-2007 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: package gui.actions;
043:
044: import org.netbeans.jellytools.Bundle;
045: import org.netbeans.jellytools.NewProjectNameLocationStepOperator;
046: import org.netbeans.jellytools.NewProjectWizardOperator;
047: import org.netbeans.jellytools.actions.CloseAllDocumentsAction;
048:
049: import org.netbeans.jemmy.EventTool;
050: import org.netbeans.jemmy.operators.ComponentOperator;
051:
052: import org.netbeans.junit.ide.ProjectSupport;
053:
054: /**
055: * Test create CreateCompositeApplication
056: *
057: * @author rashid@netbeans.org
058: */
059: public class CreateCompositeApplication extends
060: org.netbeans.performance.test.utilities.PerformanceTestCase {
061:
062: private NewProjectNameLocationStepOperator wizard_location;
063:
064: private String category, project, project_name;
065:
066: private int index;
067:
068: /**
069: * Creates a new instance of CreateCompositeApplication
070: * @param testName the name of the test
071: */
072: public CreateCompositeApplication(String testName) {
073: super (testName);
074: expectedTime = 10000;
075: WAIT_AFTER_OPEN = 10000;
076: }
077:
078: /**
079: * Creates a new instance of CreateCompositeApplication
080: * @param testName the name of the test
081: * @param performanceDataName measured values will be saved under this name
082: */
083: public CreateCompositeApplication(String testName,
084: String performanceDataName) {
085: super (testName, performanceDataName);
086: expectedTime = 10000;
087: WAIT_AFTER_OPEN = 10000;
088: }
089:
090: public void initialize() {
091: category = Bundle.getStringTrimmed(
092: "org.netbeans.modules.bpel.project.wizards.Bundle",
093: "Templates/Project/SOA"); // "Service Oriented Architecture"
094: // project = Bundle.getStringTrimmed("org.netbeans.modules.bpel.project.wizards.Bundle","Templates/Project/SOA/emptyBpelpro.xml"); // "Composite Application"
095: project = "Composite Application"; // NOI18N
096: index = 1;
097: }
098:
099: public void prepare() {
100: NewProjectWizardOperator wizard = NewProjectWizardOperator
101: .invoke();
102: wizard.selectCategory(category);
103: wizard.selectProject(project);
104: wizard.next();
105: wizard_location = new NewProjectNameLocationStepOperator();
106:
107: String directory = System.getProperty("xtest.tmpdir")
108: + java.io.File.separator + "createdProjects";
109: log("================= Destination directory={" + directory
110: + "}");
111: // wizard_location.txtProjectLocation().setText("");
112: new EventTool().waitNoEvent(1000);
113: wizard_location.txtProjectLocation().setText(directory);
114:
115: project_name = "CompositeApp_" + (index++);
116: log("================= Project name=" + project_name + "}");
117: wizard_location.txtProjectName().setText("");
118: new EventTool().waitNoEvent(1000);
119: wizard_location.txtProjectName().typeText(project_name);
120: }
121:
122: public ComponentOperator open() {
123: wizard_location.finish();
124: return null;
125: }
126:
127: public void close() {
128: ProjectSupport.closeProject(project_name);
129: // new CloseAllDocumentsAction().performAPI(); //avoid issue 68671 - editors are not closed after closing project by ProjectSupport
130: }
131:
132: public static void main(java.lang.String[] args) {
133: junit.textui.TestRunner.run(new CreateCompositeApplication(
134: "measureTime"));
135: }
136: }
|