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.NewFileNameLocationStepOperator;
046: import org.netbeans.jellytools.NewFileWizardOperator;
047: import org.netbeans.jellytools.NewProjectNameLocationStepOperator;
048: import org.netbeans.jellytools.NewProjectWizardOperator;
049: import org.netbeans.jellytools.actions.CloseAllDocumentsAction;
050:
051: import org.netbeans.jemmy.EventTool;
052: import org.netbeans.jemmy.operators.ComponentOperator;
053:
054: import org.netbeans.junit.ide.ProjectSupport;
055:
056: /**
057: * Test Add New Bpel Process
058: *
059: * @author rashid@netbeans.org, mmirilovic@netbeans.org
060: */
061: public class AddNewEnterprise extends
062: org.netbeans.performance.test.utilities.PerformanceTestCase {
063: protected NewProjectNameLocationStepOperator projectName_wizardLocation; // wizard_location
064: protected NewFileNameLocationStepOperator fileName_wizardLocation; // location
065:
066: protected static final String BUNDLE = "org.netbeans.modules.bpel.project.wizards.Bundle";
067: protected static final String PROJECT_CATEGORY = Bundle
068: .getStringTrimmed(BUNDLE, "Templates/Project/SOA"); // "Service Oriented Architecture"
069: protected static final String PROJECT_TYPE = Bundle
070: .getStringTrimmed(BUNDLE,
071: "Templates/Project/SOA/emptyBpelpro.xml"); // "BPEL Module"
072:
073: protected String project_name, file_category, file_type, file_name;
074: protected int index = 0;
075:
076: /**
077: * Creates a new instance of AddNewBpelProcess
078: * @param testName the name of the test
079: */
080: public AddNewEnterprise(String testName) {
081: super (testName);
082: expectedTime = 10000;
083: WAIT_AFTER_OPEN = 4000;
084: }
085:
086: /**
087: * Creates a new instance of AddNewBpelProcess
088: * @param testName the name of the test
089: * @param performanceDataName measured values will be saved under this name
090: */
091: public AddNewEnterprise(String testName, String performanceDataName) {
092: super (testName, performanceDataName);
093: expectedTime = 10000;
094: WAIT_AFTER_OPEN = 4000;
095: }
096:
097: public void testAddNewBpelProcess() {
098: project_name = "BPELModule";
099: file_category = "Service Oriented Architecture"; // NOI18N
100: file_type = "BPEL Process"; // NOI18N
101: file_name = "BPELProcess";
102: doMeasurement();
103: }
104:
105: public void testAddNewWSDLDocument() {
106: project_name = "BPELModule";
107: file_category = "XML"; // NOI18N
108: file_type = "WSDL Document"; // NOI18N
109: file_name = "WSDLDoc";
110: doMeasurement();
111: }
112:
113: public void testAddNewXMLDocument() {
114: project_name = "BPELModule";
115: file_category = "XML"; // NOI18N
116: file_type = "XML Document"; // NOI18N
117: file_name = "XMLDoc";
118: doMeasurement();
119: }
120:
121: public void testAddNewXMLSchema() {
122: project_name = "BPELModule";
123: file_category = "XML"; // NOI18N
124: file_type = "XML Schema"; // NOI18N
125: file_name = "XMLSchema";
126: doMeasurement();
127: }
128:
129: protected void initialize() {
130: //create bpel project
131: NewProjectWizardOperator wizardP = NewProjectWizardOperator
132: .invoke();
133: wizardP.selectCategory(PROJECT_CATEGORY);
134: wizardP.selectProject(PROJECT_TYPE);
135: wizardP.next();
136: projectName_wizardLocation = new NewProjectNameLocationStepOperator();
137:
138: String directory = System.getProperty("xtest.tmpdir")
139: + java.io.File.separator + "createdProjects";
140: log("================= Destination directory={" + directory
141: + "}");
142:
143: new EventTool().waitNoEvent(1000);
144: projectName_wizardLocation.txtProjectLocation().setText(
145: directory);
146:
147: log("================= Project name=" + project_name + "}");
148: projectName_wizardLocation.txtProjectName().setText("");
149: new EventTool().waitNoEvent(1000);
150: projectName_wizardLocation.txtProjectName().typeText(
151: project_name);
152: new EventTool().waitNoEvent(1000);
153: projectName_wizardLocation.finish();
154: //bpel end
155: }
156:
157: public void prepare() {
158: NewFileWizardOperator wizard = NewFileWizardOperator.invoke();
159: wizard.selectCategory(file_category);
160: wizard.selectFileType(file_type);
161:
162: wizard.next();
163:
164: new EventTool().waitNoEvent(1000);
165: fileName_wizardLocation = new NewFileNameLocationStepOperator();
166: fileName_wizardLocation.txtObjectName().setText(
167: file_name + "_" + (index++));
168: }
169:
170: public ComponentOperator open() {
171: fileName_wizardLocation.finish();
172: return null;
173: }
174:
175: public void close() {
176: new CloseAllDocumentsAction().performAPI(); //avoid issue 68671 - editors are not closed after closing project by ProjectSupport
177: }
178:
179: protected void shutdown() {
180: ProjectSupport.closeProject(project_name);
181: }
182:
183: }
|