Anonymous avatar Anonymous committed 4d87471

Fixed names of performance data + refactoring

Comments (0)

Files changed (2)

performance/enterprise/test/qa-functional/src/gui/actions/StartAppserver.java

  *
  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
  * or http://www.netbeans.org/cddl.txt.
-
+ 
  * When distributing Covered Code, include this CDDL Header Notice in each file
  * and include the License file at http://www.netbeans.org/cddl.txt.
  * If applicable, add the following below the CDDL Header, with the fields
  * "Portions Copyrighted [year] [name of copyright owner]"
  *
  * The Original Software is NetBeans. The Initial Developer of the Original
- * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
  * Microsystems, Inc. All Rights Reserved.
  */
 
 package gui.actions;
 
+import javax.swing.tree.TreePath;
 
-
-import java.io.PrintStream;
-import javax.swing.tree.TreePath;
 import org.netbeans.jellytools.RuntimeTabOperator;
 import org.netbeans.jellytools.nodes.Node;
+
 import org.netbeans.jemmy.TimeoutExpiredException;
 import org.netbeans.jemmy.operators.ComponentOperator;
 import org.netbeans.jemmy.operators.JPopupMenuOperator;
+
 import org.netbeans.progress.module.Controller;
 import org.netbeans.progress.spi.InternalHandle;
 import org.netbeans.progress.spi.TaskModel;
 /**
  * Measure application server Startup time via NetBeans TaskModel API.
  *
- * @author rashid@netbeans.org, mkhramov@netbeans.org
+ * @author rashid@netbeans.org, mkhramov@netbeans.org, mmirilovic@netbeans.org
  *
  */
 public class StartAppserver extends org.netbeans.performance.test.utilities.PerformanceTestCase {
     
-   private String  project_name;
-   private RuntimeTabOperator rto;
-   private Node asNode;
-   
-   private static PrintStream logger;
-   
-    /** Creates a new instance of StartAppserver 
-     *
+    private RuntimeTabOperator rto;
+    private Node asNode;
+    
+    /** Creates a new instance of StartAppserver
      *  @param testName
-     * 
      **/
     public StartAppserver(String testName) {
         super(testName);
-        logger = this.getLog();
-        //TODO: Adjust expectedTime value        
-        expectedTime = 45000;
-        WAIT_AFTER_OPEN=4000;        
+        expectedTime = 45000; //TODO: Adjust expectedTime value
+        WAIT_AFTER_OPEN=4000;
     }
-    /** Creates a new instance of StartAppserver 
-     *
+    
+    /** Creates a new instance of StartAppserver
      *  @param testName
      *  @param performanceDataName
-     * 
-     **/    
+     **/
     public StartAppserver(String testName, String  performanceDataName) {
-        super(testName);
-        logger = this.getLog();
-        
-        //TODO: Adjust expectedTime value
-        expectedTime = 45000;
+        super(testName, performanceDataName);
+        expectedTime = 45000; //TODO: Adjust expectedTime value
         WAIT_AFTER_OPEN=4000;
-        
     }
     
-
-   
     public void prepare() {
         log(":: prepare");
         rto = RuntimeTabOperator.invoke();
         asNode = new Node(rto.tree(),path);
         asNode.select();
     }
-
+    
     public ComponentOperator open() {
         log("::open");
         String serverIDEName = asNode.getText();
         if (popup == null) {
             throw new Error("Cannot get context menu for Application server node ");
         }
+        
         boolean startEnabled = popup.showMenuItem("Start").isEnabled(); // NOI18N
         if(startEnabled) {
             popup.pushMenuNoBlock("Start"); // NOI18N
-        }        
+        }
+        
         waitForAppServerTask("Starting", serverIDEName);
         return null;
     }
     
-    protected void shutdown() {
-        log("::shutdown");
-    }
-   
-
-  public void close(){
+    public void close(){
         log("::close");
         String serverIDEName = asNode.getText();
         
         boolean startEnabled = popup.showMenuItem("Stop").isEnabled(); // NOI18N
         if(startEnabled) {
             popup.pushMenuNoBlock("Stop"); // NOI18N
-        }          
+        }
         waitForAppServerTask("Stopping", serverIDEName);
-
-
-    } 
- private static void waitForAppServerTask(String taskName, String serverIDEName) {
+    }
+    
+    private void waitForAppServerTask(String taskName, String serverIDEName) {
         Controller controller = Controller.getDefault();
         TaskModel model = controller.getModel();
-     
+        
         InternalHandle task = waitServerTaskHandle(model,taskName+" "+serverIDEName);
         long taskTimestamp = task.getTimeStampStarted();
         
-        logger.print("task started at : "+taskTimestamp);
+        log("task started at : "+taskTimestamp);
         
-        while(1!=0) {
+        while(true) {
             int state = task.getState();
             if(state == task.STATE_FINISHED) { return; }
             try {
             } catch (InterruptedException exc) {
                 exc.printStackTrace(System.err);
                 return;
-            }            
+            }
         }
-        
     }
-    private static InternalHandle waitServerTaskHandle(TaskModel model, String serverIDEName) {
-        while(1!=0) {
+    
+    private InternalHandle waitServerTaskHandle(TaskModel model, String serverIDEName) {
+        while(true) {
             InternalHandle[] handles =  model.getHandles();
-            InternalHandle  serverTask = getServerTaskHandle(handles,serverIDEName);            
+            InternalHandle  serverTask = getServerTaskHandle(handles,serverIDEName);
             if(serverTask != null) {
-                logger.print("Returning task handle");
-                return serverTask; 
+                log("Returning task handle");
+                return serverTask;
             }
+            
             try {
                 Thread.sleep(50);
             } catch (InterruptedException exc) {
                 exc.printStackTrace(System.err);
-            }              
+            }
         }
     }
-    private static InternalHandle getServerTaskHandle(InternalHandle[] handles, String taskName) {
-       if(handles.length == 0)  { 
-            logger.print("Empty tasks queue");
-           return null; 
-       }
-       for(int i=0;i<handles.length;i++) {
-           if(handles[i].getDisplayName().equals(taskName)) {
-               logger.print("Expected task found...");
-               return handles[i];
-           }
-       }
-       return null;
+    
+    private InternalHandle getServerTaskHandle(InternalHandle[] handles, String taskName) {
+        if(handles.length == 0)  {
+            log("Empty tasks queue");
+            return null;
+        }
+        
+        for (InternalHandle internalHandle : handles) {
+            if(internalHandle.getDisplayName().equals(taskName)) {
+                log("Expected task found...");
+                return internalHandle;
+            }
+        }
+        return null;
     }
     
     public static void main(java.lang.String[] args) {
+        repeat = 2;
         junit.textui.TestRunner.run(new StartAppserver("measureTime"));
-    }    
+    }
     
 }

performance/enterprise/test/qa-functional/src/gui/actions/ValidateSchema.java

     }
     
     public ValidateSchema(String testName, String  performanceDataName) {
-        super(testName);
+        super(testName, performanceDataName);
         //TODO: Adjust expectedTime value
         expectedTime = 10000;
         WAIT_AFTER_OPEN=4000;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.