1 19 20 package gui.action; 21 22 import gui.Utils; 23 import java.io.InputStream ; 24 import java.net.URL ; 25 import org.netbeans.jellytools.Bundle; 26 import org.netbeans.jellytools.MainWindowOperator; 27 import org.netbeans.jellytools.ProjectsTabOperator; 28 import org.netbeans.jellytools.RuntimeTabOperator; 29 import org.netbeans.jellytools.nodes.Node; 30 import org.netbeans.jellytools.nodes.ProjectRootNode; 31 32 import org.netbeans.jemmy.operators.ComponentOperator; 33 import org.netbeans.jemmy.operators.JTreeOperator; 34 import org.netbeans.jemmy.operators.Operator; 35 36 37 42 public class Deploy extends org.netbeans.performance.test.utilities.PerformanceTestCase { 43 44 private Node node; 45 46 50 public Deploy(String testName) { 51 super(testName); 52 expectedTime = 60000; 53 WAIT_AFTER_OPEN=240000; 54 } 55 56 61 public Deploy(String testName, String performanceDataName) { 62 super(testName, performanceDataName); 63 expectedTime = 60000; 64 WAIT_AFTER_OPEN=240000; 65 } 66 67 68 public void initialize(){ 69 Utils.startStopServer(true); 70 71 JTreeOperator tree = ProjectsTabOperator.invoke().tree(); 72 tree.setComparator(new Operator.DefaultStringComparator(true, true)); 73 node = new ProjectRootNode(tree, "DeployTest"); 74 node.performPopupAction("Build Project"); 75 MainWindowOperator.getDefault().getTimeouts().setTimeout("Waiter.WaitingTime", 120000); 76 MainWindowOperator.getDefault().waitStatusText("Finished building build.xml (dist)"); 77 } 78 79 public void shutdown() { 80 RuntimeTabOperator runtimeTab = RuntimeTabOperator.invoke(); 81 Node node = new Node(runtimeTab.getRootNode(), Bundle.getStringTrimmed("org.netbeans.modules.j2ee.deployment.impl.ui.Bundle", "SERVER_REGISTRY_NODE") 82 +"|Application Server|" 83 + Bundle.getStringTrimmed("org.netbeans.modules.j2ee.sun.ide.j2ee.runtime.nodes.Bundle", "LBL_Applications") + "|" 84 + Bundle.getStringTrimmed("org.netbeans.modules.j2ee.sun.ide.j2ee.runtime.nodes.Bundle", "LBL_AppModules") + "|" 85 + "DeployTest"); 86 node.performPopupAction(Bundle.getStringTrimmed("org.netbeans.modules.j2ee.sun.ide.j2ee.runtime.nodes.Bundle", "LBL_Undeploy")); 87 node.waitNotPresent(); 88 89 Utils.startStopServer(false); 90 } 91 92 public void prepare(){ 93 94 } 95 96 public ComponentOperator open(){ 97 node.performPopupAction("Deploy Project"); 98 return null; 99 } 100 101 public void close() { 102 MainWindowOperator.getDefault().waitStatusText("Finished building build.xml (run-deploy)"); 103 try { 104 URL url = new URL ("http://localhost:8080/DeployTest-WebModule/TestServlet"); 105 InputStream stream = url.openStream(); 106 stream.close(); 107 } catch (Exception e) { 108 throw new RuntimeException ("Deployed application unavailable.",e); 109 } 110 } 111 112 113 } 114
| Popular Tags
|