KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > action > CreateJ2EEProject


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 package gui.action;
21
22 import gui.Utils;
23 import org.netbeans.jellytools.NewProjectNameLocationStepOperator;
24 import org.netbeans.jellytools.NewProjectWizardOperator;
25
26 import org.netbeans.jemmy.operators.ComponentOperator;
27 import org.netbeans.jemmy.operators.JCheckBoxOperator;
28 import org.netbeans.jemmy.operators.JTextFieldOperator;
29
30 import org.netbeans.junit.ide.ProjectSupport;
31
32
33 /**
34  * Test create projects
35  *
36  * @author lmartinek@netbeans.org
37  */

38 public class CreateJ2EEProject extends org.netbeans.performance.test.utilities.PerformanceTestCase {
39     
40     private NewProjectNameLocationStepOperator wizard_location;
41     
42     private String JavaDoc category, project, project_name;
43     private boolean createSubProjects = false;
44     
45     /**
46      * Creates a new instance of CreateJ2EEProject
47      * @param testName the name of the test
48      */

49     public CreateJ2EEProject(String JavaDoc testName) {
50         super(testName);
51         expectedTime = 20000;
52         WAIT_AFTER_OPEN=30000;
53     }
54     
55     /**
56      * Creates a new instance of CreateJ2EEProject
57      * @param testName the name of the test
58      * @param performanceDataName measured values will be saved under this name
59      */

60     public CreateJ2EEProject(String JavaDoc testName, String JavaDoc performanceDataName) {
61         super(testName, performanceDataName);
62         expectedTime = 20000;
63         WAIT_AFTER_OPEN=30000;
64     }
65     
66     public void testCreateEnterpriseApplicationProject(){
67         category = "Enterprise";
68         project = "Enterprise Application";
69         project_name = "MyApp";
70         createSubProjects = true;
71         doMeasurement();
72     }
73    
74     public void testCreateStandaloneEnterpriseApplicationProject(){
75         category = "Enterprise";
76         project = "Enterprise Application";
77         project_name = "MyStandaloneApp";
78         createSubProjects = false;
79         doMeasurement();
80     }
81
82     public void testCreateEJBModuleProject(){
83         category = "Enterprise";
84         project = "EJB Module";
85         project_name = "MyEJBModule";
86         doMeasurement();
87     }
88     
89     public void initialize(){
90     }
91     
92     public void prepare(){
93         NewProjectWizardOperator wizard = NewProjectWizardOperator.invoke();
94         wizard.selectCategory(category);
95         wizard.selectProject(project);
96         wizard.next();
97         wizard_location = new NewProjectNameLocationStepOperator();
98         wizard_location.txtProjectLocation().setText(System.getProperty("xtest.tmpdir"));
99         project_name += Utils.getTimeIndex();
100         wizard_location.txtProjectName().setText(project_name);
101         //project_name = wizard_location.txtProjectName().getText();
102
if (project.equals("Enterprise Application")) {
103             JCheckBoxOperator createEjb = new JCheckBoxOperator(wizard_location, "Ejb");
104             JCheckBoxOperator createWeb = new JCheckBoxOperator(wizard_location, "Web");
105             createEjb.setSelected(createSubProjects);
106             createWeb.setSelected(createSubProjects);
107         }
108     }
109     
110     public ComponentOperator open(){
111         wizard_location.finish();
112         return null;
113     }
114     
115     public void close(){
116         ProjectSupport.closeProject(project_name);
117         ProjectSupport.closeProject(project_name+"-EJBModule");
118         ProjectSupport.closeProject(project_name+"-WebModule");
119     }
120     
121     
122 }
123
Popular Tags