home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 25 / IOPROG_25.ISO / SOFT / JavaS / javastar-eval.exe / data1.cab / Help_Files / tutorial / java / OpenFile.java < prev   
Encoding:
Java Source  |  1999-02-11  |  1.4 KB  |  46 lines

  1. /* Generated by JavaStar Java GUI Testing Tool
  2.  */
  3.  
  4. import suntest.javastar.lib.*;
  5. import java.awt.*;
  6.  
  7. public class OpenFile extends Script {
  8.  
  9.  
  10.   private static String[] Args = {};
  11.   public String[] getAppArgs(){ return Args; }
  12.  
  13.   public String getAppClass(){ return "namedb"; }
  14.  
  15.   public void run() throws Throwable {
  16.     namedb.main(Args);
  17.   }
  18.  
  19.   public void play(String[] args) throws Throwable {
  20.  
  21.     // Validate 2 or more parameters were passed
  22.     if (args.length < 2) {
  23.        System.err.println("OpenFile: requires 2 params: <file> <# of entries>");
  24.        return;
  25.     }
  26.  
  27.     // convert the 2nd parameter to an int
  28.     int size=new Integer(args[1]).intValue();
  29.  
  30.     // Get the internal API
  31.     namedb thenamedb = (namedb)JS.frame("Name Database").member("namedb").getValidUnique();
  32.     RoloApi api=thenamedb.getRoloApi();
  33.  
  34.     NameData.MainWin.Open().buttonPress();
  35.  
  36.     NameData.MainWin.frame().dialog("Open").relativefile(".", args[0]);
  37.  
  38.     NameData.MainWin.frame().member("java.awt.Label", "Name Database - " + args[0]).waitFor("Name Database - " + args[0], "Proceed only if correct file loaded");
  39.  
  40.     // test the correct number of entries were found
  41.     JS.check( size == api.getSize(), "verify expected number of entries found");
  42.  
  43.     // Print out information since JS.check cannot show what we are comparing
  44.     System.out.println("checking size: expected="+size+" actual="+api.getSize());    }
  45. }
  46.