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

/*
 * WebProjectValidation13.java
 *
 * Created on 23. srpen 2004, 17:42
 */

package org.netbeans.test.web;

import java.io.IOException;
import org.netbeans.jellytools.*;
import org.netbeans.jellytools.actions.ActionNoBlock;
import org.netbeans.jellytools.nodes.Node;
import org.netbeans.jemmy.operators.*;
import org.netbeans.junit.NbTestSuite;

/**
 *
 * @author  lm97939
 */
public class WebProjectValidation13 extends WebProjectValidation {

    {
      // name of sample project
      SAMPLE_PROJECT_NAME = "SampleProject13"; // NOI18N
    }

    /** Need to be defined because of JUnit */
    public WebProjectValidation13(String name) { 
        super(name);
    }
    
    /** Use for execution inside IDE */
    public static void main(java.lang.String[] args) {
        // run whole suite
        junit.textui.TestRunner.run(suite());
        // run only selected test case
        //junit.textui.TestRunner.run(new MyModuleValidation("testT2"));
    } 
   
     public static NbTestSuite suite() {
        NbTestSuite suite = new NbTestSuite();
        suite.addTest(new WebProjectValidation13("testNewWebProject"));
        suite.addTest(new WebProjectValidation13("testNewJSP"));
        suite.addTest(new WebProjectValidation13("testNewJSP2"));
        suite.addTest(new WebProjectValidation13("testNewServlet"));
        suite.addTest(new WebProjectValidation13("testNewServlet2"));
        suite.addTest(new WebProjectValidation13("testBuildProject"));
        suite.addTest(new WebProjectValidation13("testCompileAllJSP"));
        suite.addTest(new WebProjectValidation13("testCompileJSP"));
        suite.addTest(new WebProjectValidation13("testCleanProject"));
        suite.addTest(new WebProjectValidation13("testRunProject"));
        suite.addTest(new WebProjectValidation13("testRunJSP"));
        suite.addTest(new WebProjectValidation13("testRunServlet"));
        suite.addTest(new WebProjectValidation13("testDebugProject"));
        suite.addTest(new WebProjectValidation13("testRunToCursor"));
        suite.addTest(new WebProjectValidation13("testDebugServlet"));
        suite.addTest(new WebProjectValidation13("testCreateTLD"));
        suite.addTest(new WebProjectValidation13("testCreateTagHandler"));
        suite.addTest(new WebProjectValidation13("testRunTag"));
        suite.addTest(new WebProjectValidation13("testDebugTag"));
        suite.addTest(new WebProjectValidation13("testNewHTML"));
        suite.addTest(new WebProjectValidation13("testRunHTML"));
        suite.addTest(new WebProjectValidation13("testNewSegment"));
        suite.addTest(new WebProjectValidation13("testNewDocument"));  
        suite.addTest(new WebProjectValidation13("testStopTomcat"));
        suite.addTest(new WebProjectValidation13("testStartTomcat"));
        suite.addTest(new WebProjectValidation13("testFinish"));

        return suite;     
    }
    
    /** Test creation of web project. 
     * - open New Project wizard from main menu (File|New Project)
     * - select Web|Web Application
     * - in the next panel type project name and project location
     * - finish the wizard
     * - wait until scanning of java files is finished
     * - check index.jsp is opened 
     */
    public void testNewWebProject() throws IOException {
        new ActionNoBlock("File|New Project", null).perform(); // TODO - use appropriate action
        WizardOperator newProjectWizard = new WizardOperator("New Project"); // TODO - use wizard appropriate operator (also in next lines
        JTreeOperator tree = new JTreeOperator(newProjectWizard);
        tree.getTimeouts().setTimeout("JTreeOperator.WaitNodeVisibleTimeout",30000);
        new Node(tree, "Web").select();
        new JListOperator(newProjectWizard, 1).selectItem("Web Application");
        newProjectWizard.next();
        new JTextFieldOperator(newProjectWizard, 0).typeText(SAMPLE_PROJECT_NAME);
        JTextFieldOperator txtProjectLocation = new JTextFieldOperator(newProjectWizard, 1);
        // clear text field
        txtProjectLocation.setText("");
        txtProjectLocation.typeText(SAMPLE_PROJECT_FOLDER); // NOI18N
        JComboBoxOperator combo = new JComboBoxOperator(newProjectWizard);
        combo.selectItem("J2EE 1.3");
        newProjectWizard.finish();
        Util.waitForScan();
        new EditorWindowOperator().getEditor("index.jsp");
        // HACK
        Node webPages = new Node(new ProjectsTabOperator().getProjectRootNode(SAMPLE_PROJECT_NAME),"Web Pages");
        new Node(webPages,"index.jsp");
        new Node(webPages,"WEB-INF|web.xml");
        new Node(webPages,"META-INF|context.xml");
        ref(Util.dumpProjectView(SAMPLE_PROJECT_NAME));
        compareReferenceFiles();
        //compareDD();
    }
    
    protected String getTagHandlerCode() {
        return "try { JspWriter out = pageContext.getOut(); out.println(\"TagOutput\");} catch (IOException e) {} \n";
    }


    
}
... 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.