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-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */




package org.netbeans.test.gui.web.webmodule;

import org.netbeans.junit.NbTestSuite;
import org.netbeans.jellytools.ExplorerOperator;
import org.netbeans.jellytools.JellyTestCase;
import org.netbeans.jellytools.RepositoryTabOperator;
import org.netbeans.jellytools.nodes.FilesystemNode;
import org.netbeans.jellytools.QuestionDialogOperator;
import org.netbeans.jellytools.WizardOperator;
import org.netbeans.jellytools.actions.ActionNoBlock;
import org.netbeans.jellytools.ChooseTemplateStepOperator;
import org.netbeans.jellytools.TargetLocationStepOperator;
import org.netbeans.jemmy.operators.JTextFieldOperator;
import org.netbeans.jemmy.operators.JTreeOperator;
import org.netbeans.jemmy.Waiter;
import org.netbeans.jemmy.Waitable;
import org.netbeans.jemmy.JemmyException;
import org.netbeans.jellytools.nodes.Node;
import org.netbeans.jellytools.Bundle;

import org.netbeans.test.gui.web.webmodule.util.Test_Support;
/**
 */
public class WebmoduleGroup_creation extends JellyTestCase 
{
    private static String ssep = "|";
    private static String fsep = System.getProperty("file.separator");
    private static String webmodule_group_name = "test";
    
    /** Creates a new instance of webmodule_creation */
    public WebmoduleGroup_creation(String testName) {
        super(testName);
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        junit.textui.TestRunner.run(new NbTestSuite(WebmoduleGroup_creation.class));
        
    }
       
    
    /* public void test_WebModuleGroupCreation_new(){
      //ExplorerOperator.invoke();
        String path = Test_Support.getTestDir(this.getName());
        new RepositoryTabOperator().mountLocalDirectoryAPI(path);
        String m_path1 = Bundle.getString("org.netbeans.core.ui.Bundle","CTL_New");
        String m_path2 = Bundle.getString("org.netbeans.modules.web.core.Bundle","Templates/JSP_Servlet");
        String m_path3 = Bundle.getString("org.netbeans.modules.web.config.Bundle","Templates/JSP_Servlet/ServerConfiguration.serverConfig");
        new FilesystemNode(path).performPopupActionNoBlock(m_path1+ssep+m_path2+ssep+m_path3);
        WizardOperator wzd = new WizardOperator(Bundle.getString("org.netbeans.core.ui.Bundle","CTL_New"));
        JTextFieldOperator dirOpr = new JTextFieldOperator(wzd);
        //dirOpr.clearText();
        dirOpr.typeText(webmodule_group_name);
        wzd.finish();
        assertTrue(verify_webmoduleGroup(path));
    } */
     public void test_WebModuleGroupCreation_new_menu(){
        //ExplorerOperator.invoke();
        String m_path2 = Bundle.getString("org.netbeans.modules.web.core.Bundle","Templates/JSP_Servlet");
        String m_path3 = Bundle.getString("org.netbeans.modules.web.config.Bundle","Templates/JSP_Servlet/ServerConfiguration.serverConfig");
        String path = Test_Support.getTestDir(this.getName());
        new RepositoryTabOperator().mountLocalDirectoryAPI(path);
        new ActionNoBlock("File|New", null).perform();
        
        WizardOperator wzd = new WizardOperator(Bundle.getString("org.netbeans.core.ui.Bundle","CTL_New"));
        
        new ChooseTemplateStepOperator().selectTemplate(m_path2+ssep+m_path3);
        wzd.next();
        JTextFieldOperator dirOpr = new JTextFieldOperator(wzd);
        //dirOpr.clearText();
        dirOpr.typeText(webmodule_group_name);
        //TargetLocationStepOperator tlso = new TargetLocationStepOperator();
        //tlso.setName(webmodule_group_name);
        //tlso.selectLocation(m_path2+ssep+m_path3);
                // After tree is initialized, IDE selects previously selected node =>
        // we need to wait until some node is selected and then we can
        // change selection.
        final JTreeOperator treeopr = new JTreeOperator(wzd);
        try {
            new Waiter(new Waitable() {
                public Object actionProduced(Object param) {
                    return treeopr.isSelectionEmpty() ? null: Boolean.TRUE;
                }
                public String getDescription() {
                    return("Wait selection of previously selected node is done by IDE");
                }
            }).waitAction(null);
        } catch (InterruptedException e) {
            throw new JemmyException("Interrupted.", e);
        }
        new Node(treeopr, path).select();
        
        wzd.finish();
        Test_Support.sleep();
        
        assertTrue(verify_webmoduleGroup(path));
       
    }
    
    public boolean verify_webmoduleGroup(String path){
        return Test_Support.isFileExist(path+fsep+webmodule_group_name+".serverConfig");
        
    }
    
}
... 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.