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.NbDialogOperator;
import org.netbeans.jellytools.RepositoryTabOperator;
import org.netbeans.jellytools.nodes.FilesystemNode;
import org.netbeans.jellytools.nodes.FolderNode;
import org.netbeans.jellytools.nodes.Node;
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.jellytools.Bundle;

import org.netbeans.jemmy.operators.JTreeOperator;
import java.io.File;



import org.netbeans.test.gui.web.webmodule.util.Test_Support;
/**
 */
public class WebModule_add_taglibrary extends JellyTestCase 
{
    private static String ssep = "|";
    private static String fsep = System.getProperty("file.separator");
    
    /** Creates a new instance of webmodule_creation */
    public WebModule_add_taglibrary(String testName) {
        super(testName);
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String workDir = System.getProperty("Webmodule.workdir").replace('/',File.separatorChar); 
        junit.textui.TestRunner.run(new NbTestSuite(WebModule_add_taglibrary.class));
        
    }
    public void test_WebModule_add_standard_tag(){
        
        String path = Test_Support.getTestDir(this.getName());
        String m_path2 = Bundle.getString("org.netbeans.modules.web.core.Bundle","Templates/JSP_Servlet");
        String m_path3 = Bundle.getString("org.netbeans.modules.web.context.Bundle","Templates/JSP_Servlet/webapp.warImage");
        String m_path4 = Bundle.getString("org.netbeans.modules.web.taglib.Bundle","TLS_AddTagLibAction");
        String m_path5 = Bundle.getStringTrimmed("org.netbeans.modules.web.taglib.Bundle","TLS_AddTagLibFromTagLibRepositoryAction");
        String m_path6 = Bundle.getString("org.netbeans.modules.web.taglib.Bundle","TLS_TagLibFinderFromRepDialogTitle");
        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(path);
        wzd.finish();
        Test_Support.sleep();        
        new FolderNode(path).performPopupActionNoBlock(m_path4+ssep+m_path5);
        NbDialogOperator nbd = new NbDialogOperator(m_path6);
        nbd.ok();
        Test_Support.sleep();
        assertTrue(verify_webmodule(path,"standard.jar"));
    }   

    public void test_WebModule_cancel_standard_tag(){
        
        String path = Test_Support.getTestDir(this.getName());
        String m_path2 = Bundle.getString("org.netbeans.modules.web.core.Bundle","Templates/JSP_Servlet");
        String m_path3 = Bundle.getString("org.netbeans.modules.web.context.Bundle","Templates/JSP_Servlet/webapp.warImage");
        String m_path4 = Bundle.getString("org.netbeans.modules.web.taglib.Bundle","TLS_AddTagLibAction");
        String m_path5 = Bundle.getStringTrimmed("org.netbeans.modules.web.taglib.Bundle","TLS_AddTagLibFromTagLibRepositoryAction");
        String m_path6 = Bundle.getString("org.netbeans.modules.web.taglib.Bundle","TLS_TagLibFinderFromRepDialogTitle");
        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(path);
        wzd.finish();
        Test_Support.sleep();        
        new FolderNode(path).performPopupActionNoBlock(m_path4+ssep+m_path5);
        NbDialogOperator nbd = new NbDialogOperator(m_path6);
        nbd.cancel();
        Test_Support.sleep();
        assertTrue(!verify_webmodule(path,"standard.jar"));
    }   

    public void test_WebModule_add_WEB_INF(){
        
        String path = Test_Support.getTestDir(this.getName());
        String m_path2 = Bundle.getString("org.netbeans.modules.web.core.Bundle","Templates/JSP_Servlet");
        String m_path3 = Bundle.getString("org.netbeans.modules.web.context.Bundle","Templates/JSP_Servlet/webapp.warImage");
        String m_path4 = Bundle.getString("org.netbeans.modules.web.taglib.Bundle","TLS_AddTagLibAction");
        String m_path5 = Bundle.getStringTrimmed("org.netbeans.modules.web.taglib.Bundle","TLS_AddTagLibFromTagLibRepositoryAction");
        String m_path6 = Bundle.getString("org.netbeans.modules.web.taglib.Bundle","TLS_TagLibFinderFromRepDialogTitle");
        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(path);
        wzd.finish();
        Test_Support.sleep();        
        new FolderNode(path+ssep+"WEB-INF").performPopupActionNoBlock(m_path4+ssep+m_path5);
        NbDialogOperator nbd = new NbDialogOperator(m_path6);
        nbd.ok();
        Test_Support.sleep();
        assertTrue(verify_webmodule(path,"standard.jar"));
    }   

    public void test_WebModule_add_filesystem(){
        String workDir = System.getProperty("Webmodule.workdir").replace('/',File.separatorChar); 
        String path = Test_Support.getTestDir(this.getName());
        String m_path2 = Bundle.getString("org.netbeans.modules.web.core.Bundle","Templates/JSP_Servlet");
        String m_path3 = Bundle.getString("org.netbeans.modules.web.context.Bundle","Templates/JSP_Servlet/webapp.warImage");
        String m_path4 = Bundle.getString("org.netbeans.modules.web.taglib.Bundle","TLS_AddTagLibAction");
        String m_path5 = Bundle.getStringTrimmed("org.netbeans.modules.web.taglib.Bundle","TLS_AddTagLibFromFSAction");
        String m_path6 = Bundle.getString("org.netbeans.modules.web.taglib.Bundle","TLS_TagLibFinderFromFSDialogTitle");
        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(path);
        wzd.finish();
        Test_Support.sleep();
        new RepositoryTabOperator().mountLocalDirectoryAPI(workDir);
        new FolderNode(path+ssep+"WEB-INF").performPopupActionNoBlock(m_path4+ssep+m_path5);
        NbDialogOperator nbd = new NbDialogOperator(m_path6);
        JTreeOperator tro = new JTreeOperator(nbd);
        Test_Support.sleep();
        tro.selectPath(tro.findPath(workDir + "|" +  "jtagcommunity", "|"));
        nbd.ok();
        Test_Support.sleep();
        assertTrue(verify_webmodule(path,"jtagcommunity.jar"));
    }   
    
    public boolean verify_webmodule(String path, String name){
        return (
            Test_Support.isFileExist(path+fsep+"WEB-INF"+fsep+"lib"+fsep+name)
            );
    }
    
}
... 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.