KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > action > MeasureSessionBeanAction


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 MeasureSessionBeanAction 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 MeasureSessionBeanAction
54      */

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

63     public MeasureSessionBeanAction(String JavaDoc testName, String JavaDoc performanceDataName) {
64         super(testName, performanceDataName);
65         expectedTime = WINDOW_OPEN;
66     }
67     
68      public void testAddBusinessMethod(){
69         WAIT_AFTER_OPEN = 5000;
70         popup_menu = "EJB Methods|Add Business Method";
71         title = "Add Business Method";
72         name = "testBusinessMethod";
73         doMeasurement();
74     }
75     
76     public void initialize() {
77         // open a java file in the editor
78
Node openFile = new Node(new ProjectsTabOperator().getProjectRootNode("TestApplication-EJBModule"),"Enterprise Beans|TestSessionSB");
79         new OpenAction().performAPI(openFile);
80         editor = new EditorWindowOperator().getEditor("TestSessionBean.java");
81         new org.netbeans.jemmy.EventTool().waitNoEvent(5000);
82         editor.select(11);
83         JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
84     }
85     
86     public void prepare() {
87         new ActionNoBlock(null,popup_menu).perform(editor);
88         dialog = new NbDialogOperator(title);
89         new JTextFieldOperator(dialog).setText(name+Utils.getTimeIndex());
90    }
91     
92     public ComponentOperator open(){
93         dialog.ok();
94         return null;
95     }
96
97     public void shutdown(){
98         new SaveAllAction().performAPI();
99         editor.closeDiscard();
100     }
101     
102 }
103
Popular Tags