KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > window > InvokeEJBAction


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

40 public class InvokeEJBAction extends org.netbeans.performance.test.utilities.PerformanceTestCase {
41     
42     private static EditorOperator editor;
43     
44     private String JavaDoc popupMenu = null;
45     private String JavaDoc dialogTitle = null;
46     
47     /**
48      * Creates a new instance of InvokeEJBAction
49      */

50     public InvokeEJBAction(String JavaDoc testName) {
51         super(testName);
52         expectedTime = WINDOW_OPEN;
53         WAIT_AFTER_OPEN = 1000;
54     }
55     
56     /**
57      * Creates a new instance of InvokeEJBAction
58      */

59     public InvokeEJBAction(String JavaDoc testName, String JavaDoc performanceDataName) {
60         super(testName, performanceDataName);
61         expectedTime = WINDOW_OPEN;
62         WAIT_AFTER_OPEN = 1000;
63     }
64     
65     public void testAddBusinessMethodDialog(){
66         popupMenu = "EJB Methods|Add Business Method";
67         dialogTitle = "Add Business Method";
68         doMeasurement();
69     }
70
71     public void testCallEJBDialog(){
72         popupMenu = "Enterprise Resources|" +
73                 org.netbeans.jellytools.Bundle.getStringTrimmed("org.netbeans.modules.j2ee.ejbcore.ui.logicalview.entres.Bundle", "LBL_CallEjbAction");
74         dialogTitle = "Call Enterprise Bean";
75         doMeasurement();
76     }
77     
78     public void initialize() {
79         
80         // open a java file in the editor
81
Node openFile = new Node(new ProjectsTabOperator().getProjectRootNode("TestApplication-EJBModule"),"Enterprise Beans|TestSessionSB");
82         new OpenAction().performAPI(openFile);
83         editor = new EditorWindowOperator().getEditor("TestSessionBean.java");
84         new org.netbeans.jemmy.EventTool().waitNoEvent(5000);
85         editor.select(11);
86         JemmyProperties.setCurrentDispatchingModel(JemmyProperties.ROBOT_MODEL_MASK);
87     }
88     
89     public void prepare() {
90         // do nothing
91
}
92     
93     public ComponentOperator open(){
94         new ActionNoBlock(null,popupMenu).perform(editor);
95         return new NbDialogOperator(dialogTitle);
96     }
97
98     public void shutdown(){
99         editor.closeDiscard();
100     }
101     
102 }
103
Popular Tags