alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

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.menu;

import org.netbeans.jellytools.ProjectsTabOperator;
import org.netbeans.jellytools.RuntimeTabOperator;
import org.netbeans.jellytools.nodes.Node;
import org.netbeans.jemmy.TimeoutExpiredException;

import org.netbeans.jemmy.operators.JButtonOperator;

import org.netbeans.jemmy.operators.JFrameOperator;

import org.netbeans.junit.NbTestSuite;

/**
 * Test of popup menu on nodes in Runtime View
 * @author  juhrik@netbeans.org, mmirilovic@netbeans.org
 */


public class WebRuntimeViewPopupMenu extends ValidatePopupMenuOnNodes{
    
    private static RuntimeTabOperator runtimeTab;
    
    /** Creates a new instance of RuntimeViewPopupMenu */
    public WebRuntimeViewPopupMenu(String testName) {
        super(testName);
    }
    
    /** Creates a new instance of RuntimeViewPopupMenu */
    public WebRuntimeViewPopupMenu(String testName, String performanceDataName) {
        super(testName, performanceDataName);
    }

    public void testServerRegistryPopupMenuRuntime(){
        testMenu("Server Registry");
    }
    
    public void testTomcatPopupMenuRuntime(){
        testMenu("Server Registry|Tomcat 5 Servers");
    }
    
    public void testLocalTomcatPopupMenuRuntime(){
        testMenu("Server Registry|Tomcat 5 Servers|Bundled Tomcat");
    }

    public void testWebModulesPopupMenuRuntime(){
        testMenu("Server Registry|Tomcat 5 Servers|Bundled Tomcat|Web Modules");
    }
    
    public void testWebModulePopupMenuRuntime(){
        testMenu("Server Registry|Tomcat 5 Servers|Bundled Tomcat|Web Modules|/manager");
    }

    
    private void testMenu(String path){
        runtimeTab = RuntimeTabOperator.invoke();
        dataObjectNode = new Node(runtimeTab.getRootNode(), path);
        doMeasurement();
    }

    public void setUp(){
        super.setUp();

        runtimeTab = RuntimeTabOperator.invoke();
        Node tomcatNode = new Node(runtimeTab.getRootNode(), "Server Registry|Tomcat 5 Servers|Bundled Tomcat");
        tomcatNode.performPopupAction("Start / Stop Server...");
        JFrameOperator status = new JFrameOperator("Server Status");
        JButtonOperator startButton = new JButtonOperator(status,"Start Server");
        try { startButton.waitComponentEnabled();
              startButton.push();
              status.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 60000);
              status.waitClosed();        
        }
        catch (TimeoutExpiredException e) {
              status.close();
        }
        catch (InterruptedException e) {
              status.close();
        }
        
        
/*        new ProjectsTabOperator().getProjectRootNode("TestWebProject").performPopupAction("Run Project");
        JFrameOperator mon = new JFrameOperator("Monitor");
        mon.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 60000);
        mon.waitClosed();
*/
        try { Thread.currentThread().sleep(2000); } catch (InterruptedException e) {}

    }
    
    public void shutdown(){
        runtimeTab.close();
    } 

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.