KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > action > MeasureEntityBeanAction


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.EditorOperator;
24 import org.netbeans.jellytools.EditorWindowOperator;
25 import org.netbeans.jellytools.MainWindowOperator;
26 import org.netbeans.jellytools.NbDialogOperator;
27 import org.netbeans.jellytools.ProjectsTabOperator;
28 import org.netbeans.jellytools.actions.ActionNoBlock;
29 import org.netbeans.jellytools.actions.OpenAction;
30 import org.netbeans.jellytools.actions.SaveAllAction;
31 import org.netbeans.jellytools.nodes.Node;
32 import org.netbeans.jemmy.JemmyProperties;
33
34 import org.netbeans.jemmy.operators.ComponentOperator;
35 import org.netbeans.jemmy.operators.JMenuBarOperator;
36 import org.netbeans.jemmy.operators.JTextFieldOperator;
37
38 /**
39  * Test of finishing dialogs from EJB source editor.
40  *
41  * @author lmartinek@netbeans.org
42  */

43 public class MeasureEntityBeanAction extends org.netbeans.performance.test.utilities.PerformanceTestCase {
44     
45     private static EditorOperator editor;
46     private static NbDialogOperator dialog;
47     
48     private String JavaDoc popup_menu;
49     private String JavaDoc title;
50     private String JavaDoc name;
51     
52     /**
53      * Creates a new instance of MeasureEntityBeanAction
54      */

55     public MeasureEntityBeanAction(String JavaDoc testName) {
56         super(testName);
57         expectedTime = WINDOW_OPEN;
58     }
59     
60     /**
61      * Creates a new instance of MeasureEntityBeanAction
62      */

63     public MeasureEntityBeanAction(String JavaDoc testName, String JavaDoc performanceDataName) {
64         super(testName, performanceDataName);
65         expectedTime = WINDOW_OPEN;
66     }
67     
68      public void testAddBusinessMethod(){
69         WAIT_AFTER_OPEN = 3000;
70         popup_menu = "EJB Methods|Add Business Method";
71         title = "Add Business Method";
72         name = "testBusinessMethod";
73         doMeasurement();
74     }
75
76      public void testAddFinderMethod(){
77         WAIT_AFTER_OPEN = 2000;
78         popup_menu = "EJB Methods|Add Finder Method";
79         title = "Add Finder Method";
80         name = "findByTest";
81         doMeasurement();
82     }
83
84      public void testAddSelectMethod(){
85         WAIT_AFTER_OPEN = 2000;
86         popup_menu = "EJB Methods|Add Select Method";
87         title = "Add Select Method";
88         name = "ejbSelectByTest";
89         doMeasurement();
90     }
91      
92      
93     public void initialize() {
94         // open a java file in the editor
95
Node openFile = new Node(new ProjectsTabOperator().getProjectRootNode("TestApplication-EJBModule"),"Enterprise Beans|TestEntityEB");
96         new OpenAction().performAPI(openFile);
97         editor = new EditorWindowOperator().getEditor("TestEntityBean.java");
98         new org.netbeans.jemmy.EventTool().waitNoEvent(5000);
99         editor.select(11);
100         JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
101     }
102     
103     public void prepare() {
104         new ActionNoBlock(null,popup_menu).perform(editor);
105         dialog = new NbDialogOperator(title);
106         new JTextFieldOperator(dialog).setText(name+Utils.getTimeIndex());
107         new org.netbeans.jemmy.EventTool().waitNoEvent(2000);
108    }
109     
110     public ComponentOperator open(){
111         dialog.ok();
112         return null;
113     }
114
115     public void shutdown(){
116         new SaveAllAction().performAPI();
117         editor.closeDiscard();
118     }
119     
120 }
121
Popular Tags