KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > action > MeasureWebServiceAction


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

41 public class MeasureWebServiceAction extends PerformanceTestCase {
42     
43     private static EditorOperator editor;
44     private static NbDialogOperator dialog;
45     private static Node openFile;
46     
47     private String JavaDoc popup_menu;
48     private String JavaDoc title;
49     private String JavaDoc name;
50     
51     /**
52      * Creates a new instance of MeasureWebServiceAction
53      */

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

62     public MeasureWebServiceAction(String JavaDoc testName, String JavaDoc performanceDataName) {
63         super(testName, performanceDataName);
64         expectedTime = WINDOW_OPEN;
65     }
66     
67      public void testAddOperation(){
68         WAIT_AFTER_OPEN = 5000;
69         popup_menu = Bundle.getString(
70                 "org.netbeans.modules.websvc.core.webservices.action.Bundle",
71                 "LBL_OperationAction");
72         title = Bundle.getString(
73                 "org.netbeans.modules.websvc.core.webservices.action.Bundle",
74                 "TTL_AddOperation");
75         name = "testOperation";
76         doMeasurement();
77     }
78      
79     public void initialize() {
80         // open a java file in the editor
81
openFile = new Node(new ProjectsTabOperator().getProjectRootNode(
82                 "TestApplication-WebModule"),"Web Services|TestWebService");
83         new OpenAction().performAPI(openFile);
84         editor = new EditorWindowOperator().getEditor("TestWebServiceImpl.java");
85         new org.netbeans.jemmy.EventTool().waitNoEvent(5000);
86         editor.select(11);
87     }
88     
89     public void prepare() {
90         //new ActionNoBlock(null,popup_menu).perform(editor);
91
openFile.performPopupActionNoBlock(popup_menu);
92         dialog = new NbDialogOperator(title);
93         new JTextFieldOperator(dialog).setText(name+Utils.getTimeIndex());
94         new org.netbeans.jemmy.EventTool().waitNoEvent(2000);
95    }
96     
97     public ComponentOperator open(){
98         dialog.ok();
99         return null;
100     }
101
102     public void shutdown(){
103         new SaveAllAction().performAPI();
104         editor.closeDiscard();
105     }
106     
107 }
108
Popular Tags