Пример #1
0
  protected boolean _expandNode(
      GuiSubitemTestObject curNode, String curPath, boolean refreshAfterExpand) {
    boolean success = true;

    try {
      logTAFDebug(" < **** > Expanding [" + curPath + "] of [" + curNode + "].....");
      curNode.setState(Action.expand(), atPath(curPath));
      // curNode.doubleClick( atPath(curPath));
      // curNode.setState(Action.expandAndSelect(), atPath(curPath));
    } catch (Exception e) {
      try {
        logTAFDebug(" < **** > Expanding exception [" + e.toString() + "].....");
        if (refreshAfterExpand) {
          refreshWindow((ITopWindow) (curNode.getTopParent()));
          curNode.setState(Action.expand(), atPath(curPath));
        } else {
          throw e;
        }

      } catch (Exception er) {
        success = false;
        // logTAFWarning(er.toString());
      }
    }
    if (!success) {
      logTAFDebug(
          " < **** > Exception while trying to expand [" + curPath + "] of [" + curNode + "]");
    } else {
      logTAFDebug(" < **** > Expand [" + curPath + "] of [" + curNode + "] Success !");
    }
    return success;
  }
Пример #2
0
 public Table(GuiSubitemTestObject table, String tabletype) {
   _Table = table;
   _Table.getObjectReference();
   dataTable = (ITestDataTable) _Table.getTestData(CONTENTS_TYPE);
   if (tabletype.equals(CHECK_TYPE)) {
     dataTable = (ITestDataTable) _Table.getTestData(CHECK_TYPE);
   }
   if (tabletype.equals(SELECT_TYPE)) {
     dataTable = (ITestDataTable) _Table.getTestData(SELECT_TYPE);
   }
 }
Пример #3
0
  public void setCell(int rowIndex, String colName, Location input) {

    checkRowArgument(rowIndex);
    int colIndex = getColumnIndexByName(colName);
    Cell cell = new Cell(new Row(new Index(rowIndex)), new Column(new Index(colIndex)));
    _Table.click(new List(cell, input));
  }
Пример #4
0
 /**
  * @param guiObj, TestObject may be JMenuBar or JPopupMenu
  * @param path, String is the full path of some MenuItem on which a click action will take place
  */
 protected void selectMenuItemWithoutVerification(GuiSubitemTestObject guiObj, String path) {
   com.rational.test.ft.script.List list = Script.localAtPath(path);
   // guiObj.setState(Action.select(), list); // RobotJ doesn't like this...
   try {
     guiObj.click(list);
     // set status to ok
     testRecordData.setStatusCode(StatusCodes.OK);
     String altText =
         "MenuItem \"" + path + "\" clicked, " + windowName + ":" + compName + " " + action;
     log.logMessage(
         testRecordData.getFac(),
         passedText.convert(PRE_TXT_SUCCESS_4, altText, path, windowName, compName, action),
         PASSED_MESSAGE);
   } catch (TargetGoneException tge) {
     Log.info(
         "CFMenuBar IGNORING TargetGoneException probably resulting from intended window closure...");
     // set status to ok
     testRecordData.setStatusCode(StatusCodes.OK);
     String altText =
         "MenuItem \"" + path + "\" clicked, " + windowName + ":" + compName + " " + action;
     log.logMessage(
         testRecordData.getFac(),
         passedText.convert(PRE_TXT_SUCCESS_4, altText, path, windowName, compName, action),
         PASSED_MESSAGE);
   } catch (NullPointerException npe) {
     testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE);
     log.logMessage(testRecordData.getFac(), "item not found: " + path, FAILED_MESSAGE);
   }
 }
Пример #5
0
  // [2007/6/4 Rain Chen]
  // added doubleClickCell which execute the double click cell action
  public void doubleClickCell(String rowValue, int col) {
    int rowIndex = getRowIndexByName(rowValue, col);
    System.out.println(rowIndex);
    checkColArgument(col);
    Cell cell = new Cell(new Row(new Index(rowIndex)), new Column(new Index(col)));

    java.awt.Point p = new Point();
    p.x = 16;
    p.y = 3;
    _Table.doubleClick(cell, p);
  }
Пример #6
0
 public void setCell(int rowIndex, int colIndex, String input, boolean doubleClick) {
   if (doubleClick) {
     doubleClickCell(rowIndex, colIndex);
   } else {
     clickCell(rowIndex, colIndex);
   }
   IWindow w = RationalTestScript.getScreen().getActiveWindow();
   w.inputKeys("{ExtHome}+{ExtEnd}{ExtDelete}");
   w.inputChars(input);
   _Table.click();
 }
Пример #7
0
  protected void adjustAnaStatusWindow(
      GuiSubitemTestObject table, GuiSubitemTestObject gsto, int xoffset, int yoffset) {
    int offx = 1, offy = 1;
    Rectangle trec = table.getScreenRectangle();
    Rectangle tree = gsto.getScreenRectangle();
    int x, y;

    x = tree.width + offx;
    if (xoffset >= 0 && trec.width != xoffset) {
      xoffset = xoffset - trec.width;
      y = (int) (tree.height / 2);
      gsto.hover(atPoint(x, y));
      gsto.dragToScreenPoint(atPoint(x, y), atPoint(tree.x + x + xoffset, tree.y + y));
      logTAFInfo("Window size ajusted with x offset '" + xoffset + "'");
    }
    //		if(yoffset!=0&&(Math.abs(trec.height-Math.abs(yoffset))>5)){
    if (yoffset >= 0 && trec.height != yoffset) {
      yoffset = yoffset - trec.height;
      y = tree.height + offy;
      logTAFDebug(
          "Point to adjust win from : ("
              + (tree.x + x)
              + ","
              + (tree.y + y)
              + ") to : ("
              + (tree.x + x)
              + ","
              + (tree.y + y - yoffset)
              + ")");
      gsto.hover(atPoint(x, y));
      gsto.dragToScreenPoint(atPoint(x, y), atPoint(tree.x + x, tree.y + y - yoffset));
      logTAFInfo("Window size ajusted with y offset '" + yoffset + "'");
    }
  }
Пример #8
0
 /**
  * @param guiObj, TestObject may be JMenuBar or JPopupMenu
  * @param path, String is the full path of some MenuItem on which a click action will take place
  * @param fuzzy, boolean, If true, we will do a non-exact verification of existance of path
  */
 protected void selectMenuItemWithVerification(
     GuiSubitemTestObject guiObj, String path, boolean fuzzy) {
   MenuTree atree = null;
   try {
     atree = (MenuTree) extractMenuItems(guiObj, 0);
     log.logMessage(testRecordData.getFac(), "atree: " + atree, DEBUG_MESSAGE);
     // Do the work of matching..., verify the path
     // If fuzzy is true, do the partial match; otherwise do the exact match
     String match = atree.matchPath(path, fuzzy, null);
     if (match != null) {
       log.logMessage(testRecordData.getFac(), "match: " + match, DEBUG_MESSAGE);
       com.rational.test.ft.script.List slist = Script.localAtPath(match);
       try {
         guiObj.click(slist);
         // set status to ok
         testRecordData.setStatusCode(StatusCodes.OK);
         String altText =
             "MenuItem \"" + match + "\" clicked, " + windowName + ":" + compName + " " + action;
         log.logMessage(
             testRecordData.getFac(),
             passedText.convert(PRE_TXT_SUCCESS_4, altText, match, windowName, compName, action),
             PASSED_MESSAGE);
       } catch (TargetGoneException tge) {
         Log.info(
             "CFMenuBar IGNORING TargetGoneException probably resulting from intended window closure...");
         // set status to ok
         testRecordData.setStatusCode(StatusCodes.OK);
         String altText =
             "MenuItem \"" + match + "\" clicked, " + windowName + ":" + compName + " " + action;
         log.logMessage(
             testRecordData.getFac(),
             passedText.convert(PRE_TXT_SUCCESS_4, altText, match, windowName, compName, action),
             PASSED_MESSAGE);
       } catch (NullPointerException npe) {
         testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE);
         log.logMessage(testRecordData.getFac(), "item not found: " + path, FAILED_MESSAGE);
       }
     } else {
       testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE);
       log.logMessage(
           testRecordData.getFac(),
           getClass().getName() + ": no match on: " + path,
           FAILED_MESSAGE);
     }
   } catch (SAFSException se) {
     testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE);
     log.logMessage(
         testRecordData.getFac(), getClass().getName() + ": " + se.getMessage(), FAILED_MESSAGE);
   }
 }
Пример #9
0
  /**
   * <br>
   * <em>Purpose:</em> Select a menuItem <br>
   * <br>
   * We use an equivalent of this to accomplish the select:
   * jmbMenuBar().click(atPath("Admin->Customers..."));
   *
   * @param menuObj -- GuiSubItemTestObject representing a JMenuBar or JPopupMenu or JMenuItem or
   *     JMenu or MainMenu, MenuItem, MenuStrip, and ToolStripMenuItem
   * @param menuItemPath -- String, path information to the final JMenu or JMenuItem or MenuItem or
   *     ToolStripMenuItem to be selected.
   * @param fuzzy -- If false, match the given path exactly with the Menu. This parameter will not
   *     be used if verify is false.
   * @param verify -- If true, verify existance of path before selecting.
   * @exception SAFSException
   */
  protected void selectMenuBar(
      TestObject menuObj, String menuItemPath, boolean fuzzy, boolean verify) throws SAFSException {

    String debugMsg = getClass().getName() + ".selectMenuBar(): ";

    // Create a new StringBuffer path to store the full path when calling getSubMenuItemFullPath()
    StringBuffer path = new StringBuffer(menuItemPath);

    GuiSubitemTestObject guiObj = null;
    // If the object is a sub-menu,
    // try to get the test proxy object of "MenuBar" or "PopupMenu" and get the full path.
    if (!isMenuBar(menuObj)) {
      Log.debug(
          debugMsg
              + "JSAFSBefore get full path: "
              + menuObj.getObjectClassName()
              + " $$ path="
              + path);
      guiObj = getSubMenuItemFullPath(menuObj, path);
      if (guiObj == null) {
        Log.debug(
            debugMsg + "Can not get the test object of 'MenuBar' or 'PopupMenu' for " + menuObj);
        throw new SAFSException("Can not get the test object of 'MenuBar' or 'PopupMenu'.");
      }
      Log.debug(
          debugMsg + "After get full path: " + guiObj.getObjectClassName() + " $$ path=" + path);
    } else {
      guiObj = new GuiSubitemTestObject(menuObj.getObjectReference());
    }
    // Check the existance of path
    if (verify) {
      selectMenuItemWithVerification(guiObj, path.toString(), fuzzy);
    } else {
      // If we don't verify the existance of path, no need the fuzzy parameter
      selectMenuItemWithoutVerification(guiObj, path.toString());
    }
  }
Пример #10
0
  public boolean dofeature(String featurename, String profiletype, boolean state) {

    // beging state should be set true
    if (state) {

    } else {
      GuiSubitemTestObject table =
          DOF.getTableByColumnsNames(
              DOF.getDualHeadersTable(DOF.getRoot()),
              new String[] {"Feature", "Basic Profile", "Advanced Profile"});
      System.out.println("table :" + table.getParent());
      // need to get table..............................
      //			GuiSubitemTestObject table = DOF.getTable(DOF.getRoot());
      int rowIndex = TableHelper.getRowIndexOfRecordInColumn(table, "Feature", "Cache");

      System.out.println("rowindex = " + rowIndex);
      // xuan option>>>>>>>>

      //			DOF.getRadioButton(DOF.getActiveDialog(), "On de&mand").click();

      // <<<<<<<<<<<
    }
    return state;
  }
Пример #11
0
  protected boolean expandNode(
      GuiSubitemTestObject curNode, String nodePath, boolean refreshWindow) {
    boolean success = true;

    String curFullPath = "";
    String tmpFullPath;
    boolean isAxAddins =
        (nodePath.startsWith(REP_WORKING) || nodePath.startsWith(REP_LIBRARY)) ? false : true;

    int i = 0;

    //		if(refreshWindow){
    //			callScript(pathToKeywordScripts + "viewMenuOperations", new Object[]{"refresh", "No"});
    //		}

    for (String curPath : nodePath.split(SEP_REP_PATH)) {
      curFullPath += curPath;
      success = _expandNode(curNode, curFullPath, refreshWindow);
      if (!success) break;
      if ((i == 2)
          && (!isAxAddins)) { // expand Related Files and Data folder as well for nodePath pointing
                              // to activity
        tmpFullPath = curFullPath + SEP_REP_PATH + NLSUtil.convert2Locale("relatedFilesContainer");
        success = _expandNode(curNode, tmpFullPath, true);
        tmpFullPath = curFullPath + SEP_REP_PATH + NLSUtil.convert2Locale("dataModel");
        success = _expandNode(curNode, tmpFullPath, true);
        tmpFullPath = curFullPath + SEP_REP_PATH + NLSUtil.convert2Locale("resultSet");
        success = _expandNode(curNode, tmpFullPath, true);
        tmpFullPath = curFullPath + SEP_REP_PATH + NLSUtil.convert2Locale("analyticsContainer");
        success = _expandNode(curNode, tmpFullPath, true);
      }

      curFullPath += SEP_REP_PATH;
      i++;
    }
    try {
      refreshWindow((ITopWindow) (curNode.getTopParent()));
    } catch (Exception e) {
      logTAFWarning("Failed to refresh window " + e.toString());
    }
    // logTAFDebug("Trying to expand '"+nodePath+" actual expanded: '"+nodePath+"' success ? =
    // "+success);

    return success;
  }
Пример #12
0
 /**
  * Click at the specified text
  *
  * @param text
  */
 public void click(String text) {
   _Table.click(new Text(text));
 }
Пример #13
0
 public Table(GuiSubitemTestObject table) {
   _Table = table;
   _Table.getObjectReference();
   dataTable = (ITestDataTable) _Table.getTestData(CONTENTS_TYPE);
 }
Пример #14
0
 // [2007/6/15 Lucy Bi]
 // added clickColumnHeader
 public void clickColumnHeader(String HeaderName) {
   _Table.click(SubitemFactory.atHeader(SubitemFactory.atText(HeaderName)));
 }
Пример #15
0
 // [2007/6/4 Rain Chen]
 // added clickCell which execute the click cell action
 public void clickCell(int row, String colName) {
   int col = getColumnIndexByName(colName);
   Cell cell = new Cell(new Row(new Index(row)), new Column(new Index(col)));
   _Table.click(cell);
 }
Пример #16
0
 // [2007/6/4 Rain Chen]
 // added clickCell which execute the click cell action
 public void clickCell(int row, int col) {
   Cell cell = new Cell(new Row(new Index(row)), new Column(new Index(col)));
   _Table.click(cell);
 }