|
What this is
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package gui.action;
import org.netbeans.jellytools.EditorOperator;
import org.netbeans.jellytools.ProjectsTabOperator;
import org.netbeans.jellytools.nodes.Node;
import org.netbeans.jemmy.operators.ComponentOperator;
import org.netbeans.jemmy.operators.JPopupMenuOperator;
/**
* Test of opening files.
*
* @author mmirilovic@netbeans.org
*/
public class OpenServletFile extends testUtilities.PerformanceTestCase {
/** Node to be opened/edited */
public static Node openNode ;
/** Folder with data */
public static String fileProject;
/** Folder with data */
public static String filePackage;
/** Name of file to open */
public static String fileName;
/** Menu item name that opens the editor */
public static String menuItem;
protected static String OPEN = "Open"; //NOI18N
protected static String EDIT = "Edit"; //NOI18N
/**
* Creates a new instance of OpenFiles
* @param testName the name of the test
*/
public OpenServletFile(String testName) {
super(testName);
expectedTime = WINDOW_OPEN;
}
/**
* Creates a new instance of OpenFiles
* @param testName the name of the test
* @param performanceDataName measured values will be saved under this name
*/
public OpenServletFile(String testName, String performanceDataName) {
super(testName, performanceDataName);
expectedTime = WINDOW_OPEN;
}
public void testOpeningServletFile(){
WAIT_AFTER_OPEN = 6000;
MEASURE_PAINT_NUMBER = 1;
setPaintFilteringForEditor();
setJavaEditorCaretFilteringOn();
fileProject = "TestWebProject";
filePackage = "test";
fileName = "TestServlet.java";
menuItem = OPEN;
doMeasurement();
}
public void testOpeningJavaFile(){
WAIT_AFTER_OPEN = 6000;
MEASURE_PAINT_NUMBER = 1;
setPaintFilteringForEditor();
setJavaEditorCaretFilteringOn();
fileProject = "TestWebProject";
filePackage = "test";
fileName = "Main.java";
menuItem = OPEN;
doMeasurement();
}
public void initialize(){
EditorOperator.closeDiscardAll();
}
public void shutdown(){
EditorOperator.closeDiscardAll();
}
public void prepare(){
this.openNode = new Node(new ProjectsTabOperator().getProjectRootNode(fileProject),"Source Packages" + '|' + filePackage + '|' + fileName);
if (this.openNode == null) {
fail ("Cannot find node ["+"Source Packages" + '|' + filePackage + '|' + fileName + "] in project [" + fileProject + "]");
}
log("========== Open file path ="+this.openNode.getPath());
}
public ComponentOperator open(){
JPopupMenuOperator popup = this.openNode.callPopup();
if (popup == null) {
fail ("Cannot get context menu for node ["+"Source Packages" + '|' + filePackage + '|' + fileName + "] in project [" + fileProject + "]");
}
log("------------------------- after popup invocation ------------");
try {
popup.pushMenu(this.menuItem);
}
catch (org.netbeans.jemmy.TimeoutExpiredException tee) {
fail ("Cannot push menu item "+this.menuItem+" of node ["+"Source Packages" + '|' + filePackage + '|' + fileName + "] in project [" + fileProject + "]");
}
log("------------------------- after open ------------");
return new EditorOperator(this.fileName);
}
public void close(){
if (testedComponentOperator != null) {
((EditorOperator)testedComponentOperator).closeDiscard();
}
else {
fail ("no component to close");
}
}
}
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.