KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gui > action > ExpandEJBNodesProjectsView


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 org.netbeans.jellytools.ProjectsTabOperator;
23
24 import org.netbeans.jellytools.actions.MaximizeWindowAction;
25 import org.netbeans.jellytools.actions.RestoreWindowAction;
26
27 import org.netbeans.jellytools.nodes.Node;
28
29 import org.netbeans.jemmy.operators.ComponentOperator;
30
31
32 /**
33  * Test of expanding nodes/folders in the Explorer.
34  *
35  * @author mmirilovic@netbeans.org
36  */

37 public class ExpandEJBNodesProjectsView extends org.netbeans.performance.test.utilities.PerformanceTestCase {
38     
39     /** Name of the folder which test creates and expands */
40     private static String JavaDoc project;
41     
42     /** Path to the folder which test creates and expands */
43     private static String JavaDoc pathToFolderNode;
44     
45     /** Node represantation of the folder which test creates and expands */
46     private static Node nodeToBeExpanded;
47     
48     /** Projects tab */
49     private static ProjectsTabOperator projectTab;
50     
51     /** Project with data for these tests */
52     private static String JavaDoc testDataProject = "TestApplication-EJBModule";
53     
54     /**
55      * Creates a new instance of ExpandNodesInExplorer
56      * @param testName the name of the test
57      */

58     public ExpandEJBNodesProjectsView(String JavaDoc testName) {
59         super(testName);
60         expectedTime = WINDOW_OPEN;
61     }
62     
63     /**
64      * Creates a new instance of ExpandNodesInExplorer
65      * @param testName the name of the test
66      * @param performanceDataName measured values will be saved under this name
67      */

68     public ExpandEJBNodesProjectsView(String JavaDoc testName, String JavaDoc performanceDataName) {
69         super(testName, performanceDataName);
70         expectedTime = WINDOW_OPEN;
71     }
72     
73
74     public void testExpandEjbProjectNode(){
75         WAIT_AFTER_OPEN = 2000;
76         WAIT_AFTER_PREPARE = 2000;
77         project = testDataProject;
78         pathToFolderNode = "";
79         doMeasurement();
80     }
81
82     public void testExpandEjbNode(){
83         WAIT_AFTER_OPEN = 2000;
84         WAIT_AFTER_PREPARE = 2000;
85         project = testDataProject;
86         pathToFolderNode = "Enterprise Beans";
87         doMeasurement();
88     }
89     
90     
91     public void initialize(){
92         projectTab = new ProjectsTabOperator();
93         new MaximizeWindowAction().performAPI(projectTab);
94         
95         projectTab.getProjectRootNode(testDataProject).collapse();
96         
97         turnBadgesOff();
98         repaintManager().setOnlyExplorer(true);
99     }
100         
101         
102     public void prepare() {
103         if(pathToFolderNode.equals(""))
104             nodeToBeExpanded = projectTab.getProjectRootNode(project);
105         else
106             nodeToBeExpanded = new Node(projectTab.getProjectRootNode(project), pathToFolderNode);
107     }
108     
109     public ComponentOperator open(){
110         nodeToBeExpanded.tree().clickOnPath(nodeToBeExpanded.getTreePath(), 2);
111 // nodeToBeExpanded.tree().clickMouse(2);
112
// nodeToBeExpanded.waitExpanded();
113
nodeToBeExpanded.expand();
114         return null;
115     }
116     
117     public void close(){
118         nodeToBeExpanded.collapse();
119     }
120     
121     public void shutdown() {
122         repaintManager().setOnlyExplorer(false);
123         turnBadgesOn();
124         projectTab.getProjectRootNode(testDataProject).collapse();
125         new RestoreWindowAction().performAPI(projectTab);
126     }
127
128     /**
129      * turn badges off
130      */

131     protected void turnBadgesOff() {
132         System.setProperty("perf.dont.resolve.java.badges", "true");
133     }
134
135     /**
136      * turn badges on
137      */

138     protected void turnBadgesOn() {
139         System.setProperty("perf.dont.resolve.java.badges", "false");
140     }
141     
142 }
143
Popular Tags