1 19 20 package org.netbeans.test.web; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import org.netbeans.jellytools.*; 25 import org.netbeans.jellytools.actions.ActionNoBlock; 26 import org.netbeans.jellytools.actions.NewProjectAction; 27 import org.netbeans.jellytools.nodes.Node; 28 import org.netbeans.jellytools.nodes.SourcePackagesNode; 29 import org.netbeans.jemmy.EventTool; 30 import org.netbeans.jemmy.QueueTool; 31 import org.netbeans.jemmy.Timeouts; 32 import org.netbeans.jemmy.operators.*; 33 import org.netbeans.junit.NbTestSuite; 34 import org.netbeans.junit.ide.ProjectSupport; 35 36 40 public class WebProjectValidationNb36WebModule extends WebProjectValidation { 41 42 static { 43 PROJECT_NAME = "WebModuleNB36"; PROJECT_FOLDER = PROJECT_LOCATION+File.separator+PROJECT_NAME; 45 } 46 47 48 public WebProjectValidationNb36WebModule(String name) { 49 super(name); 50 } 51 52 53 public static void main(java.lang.String [] args) { 54 junit.textui.TestRunner.run(suite()); 56 } 59 60 public static NbTestSuite suite() { 61 NbTestSuite suite = new NbTestSuite(); 62 suite.addTest(new WebProjectValidationNb36WebModule("testNewWebProject")); 63 suite.addTest(new WebProjectValidationNb36WebModule("testNewJSP")); 64 suite.addTest(new WebProjectValidationNb36WebModule("testNewJSP2")); 65 suite.addTest(new WebProjectValidationNb36WebModule("testNewServlet")); 66 suite.addTest(new WebProjectValidationNb36WebModule("testNewServlet2")); 67 suite.addTest(new WebProjectValidationNb36WebModule("testBuildProject")); 68 suite.addTest(new WebProjectValidationNb36WebModule("testCompileAllJSP")); 69 suite.addTest(new WebProjectValidationNb36WebModule("testCompileJSP")); 70 suite.addTest(new WebProjectValidationNb36WebModule("testCleanProject")); 71 suite.addTest(new WebProjectValidationNb36WebModule("testRunProject")); 72 suite.addTest(new WebProjectValidationNb36WebModule("testRunJSP")); 73 suite.addTest(new WebProjectValidationNb36WebModule("testRunServlet")); 74 suite.addTest(new WebProjectValidationNb36WebModule("testCreateTLD")); 75 suite.addTest(new WebProjectValidationNb36WebModule("testCreateTagHandler")); 76 suite.addTest(new WebProjectValidationNb36WebModule("testRunTag")); 77 suite.addTest(new WebProjectValidationNb36WebModule("testNewHTML")); 78 suite.addTest(new WebProjectValidationNb36WebModule("testRunHTML")); 79 suite.addTest(new WebProjectValidationNb36WebModule("testNewSegment")); 80 suite.addTest(new WebProjectValidationNb36WebModule("testNewDocument")); 81 suite.addTest(new WebProjectValidationNb36WebModule("testStopTomcat")); 82 suite.addTest(new WebProjectValidationNb36WebModule("testStartTomcat")); 83 suite.addTest(new WebProjectValidationNb36WebModule("testFinish")); 84 85 return suite; 86 } 87 88 96 public void testNewWebProject() throws IOException { 97 installJemmyQueue(); 98 new NewProjectAction().perform(); 99 NewProjectWizardOperator projectWizard = new NewProjectWizardOperator(); 100 projectWizard.selectCategory("Web"); 101 projectWizard.selectProject("Web Application with Existing Sources"); 102 projectWizard.next(); 103 NewWebProjectNameLocationStepOperator 104 nameStep = new NewWebProjectNameLocationStepOperator(); 105 nameStep.txtLocation().setText(getDataDir().getAbsolutePath()+ 106 File.separator+PROJECT_NAME); 107 nameStep.txtProjectName().setText(PROJECT_NAME); 108 nameStep.txtProjectFolder().setText(System.getProperty("xtest.data")+ 109 File.separator+PROJECT_NAME+"Prj"); 110 nameStep.next(); 111 NewWebProjectSourcesStepOperator srcStep = 112 new NewWebProjectSourcesStepOperator(); 113 srcStep.finish(); 114 Timeouts timeouts = nameStep.getTimeouts().cloneThis(); 115 srcStep.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 90000); 116 srcStep.waitClosed(); 117 srcStep.setTimeouts(timeouts); 118 sleep(5000); 119 ProjectSupport.waitScanFinished(); 121 Node webPages = new Node(new ProjectsTabOperator(). 124 getProjectRootNode(PROJECT_NAME),"Web Pages"); 125 new Node(webPages,"WEB-INF|web.xml"); 127 new Node(webPages,"META-INF|context.xml"); 128 new Node(webPages,"WEB-INF|classes|dummy"); 129 new Node(webPages,"WEB-INF|lib|dummy"); 130 new Node(new SourcePackagesNode(PROJECT_NAME), 131 "<default package>|dummy"); 132 ref(Util.dumpProjectView(PROJECT_NAME)); 133 compareReferenceFiles(); 134 } 136 137 145 public void testNewJSP() throws IOException { 146 new ProjectsTabOperator().getProjectRootNode(PROJECT_NAME).select(); 148 149 new ActionNoBlock("File|New File", null).perform(); 150 new EventTool().waitNoEvent(1000); 152 WizardOperator newFileWizard = new WizardOperator("New File"); 153 new JComboBoxOperator(newFileWizard).selectItem(PROJECT_NAME); 154 new Node(new JTreeOperator(newFileWizard), "Java Classes").select(); 156 new Node(new JTreeOperator(newFileWizard), "Web").select(); 157 new JListOperator(newFileWizard, 1).selectItem("JSP"); 158 newFileWizard.next(); 159 JTextFieldOperator txtPackageName = new JTextFieldOperator(newFileWizard); 160 txtPackageName.setText("index"); 163 JTextFieldOperator txtProjectFolder = new JTextFieldOperator( 164 newFileWizard, 2); 165 txtProjectFolder.setText(""); 166 newFileWizard.finish(); 168 new EditorOperator("index.jsp").close(); 170 ref(Util.dumpProjectView(PROJECT_NAME)); 171 new Node(new ProjectsTabOperator().getProjectRootNode(PROJECT_NAME),"Web Pages|index.jsp"); 172 } 175 176 177 178 } 179 | Popular Tags |