private void setArgumentsForTestUsing(Vector employees) {
    setArguments(new Vector());

    Enumeration names = getExpressionParameters().elements();
    Enumeration employeeEnum = employees.elements();
    while (names.hasMoreElements()) {
      Employee emp = (Employee) employeeEnum.nextElement();
      getArguments().add(emp.getId());
      names.nextElement();
    }
  }
コード例 #2
0
  public void test() {
    Vector sessions = new Vector();

    try {
      for (int i = 0; i < stressLevel; i++) {
        Session session =
            new Project(getSession().getDatasourceLogin().clone()).createDatabaseSession();
        ((DatabaseSession) session).login();
        sessions.addElement(session);
      }
      getSession().readObject(Address.class);
    } finally {
      for (Enumeration sessionEnum = sessions.elements(); sessionEnum.hasMoreElements(); ) {
        ((DatabaseSession) sessionEnum.nextElement()).logout();
      }
    }
    getSession().readObject(Address.class);
  }
  public void setup() {
    // JGL: If the arguments are already set by the test, don't
    // set them again
    if (!hasArguments()) {
      setArgumentsForTestUsing(getSomeEmployees());
    }
    ReadAllQuery raq = new ReadAllQuery();
    raq.setReferenceClass(Employee.class);
    raq.setSelectionCriteria(getOriginalObjectExpression());
    // Add all the arguments to the query
    Enumeration enumtr = getExpressionParameters().elements();
    while (enumtr.hasMoreElements()) {
      raq.addArgument((String) enumtr.nextElement());
    }

    // Save the retrieved employees for the verify
    setOriginalOject(getSession().executeQuery(raq, getArguments()));

    // Finish the setup
    super.setup();
  }