/*
   * This verify method presumes that the stored procedure in EmployeeCustomSQLSystem.buildSQLInsertProcedure
   * has not changed and still returns an output parameter VERSION with value 952
   */
  public void verify() {
    if (this.events.isEmpty()) {
      throw new TestErrorException("No session events were thrown and some were expected");
    } else {
      if (((Number)
                  ((DatabaseRecord) ((SessionEvent) events.firstElement()).getResult())
                      .get("EMPLOYEE.VERSION"))
              .intValue()
          != 952) {
        throw new TestErrorException("Wrong value returned");
      }

      if (((WriteObjectQuery) ((SessionEvent) events.firstElement()).getQuery()).getObject()
          == null) {
        throw new TestErrorException("Object not set");
      }
    }
  }
  public void setup() {
    // Get the baseline employees for the verify
    Employee emp = (Employee) getSomeEmployees().firstElement();

    String parameterName = "firstName";
    ExpressionBuilder builder = new ExpressionBuilder();
    Expression whereClause = builder.get("firstName").equal(builder.getParameter(parameterName));

    ReadAllQuery raq = new ReadAllQuery();
    raq.setReferenceClass(Employee.class);
    raq.setSelectionCriteria(whereClause);
    raq.addArgument(parameterName);

    Vector parameters = new Vector();
    parameters.add(emp.getFirstName());

    Vector employees = (Vector) getSession().executeQuery(raq, parameters);

    emp = (Employee) employees.firstElement();

    // Set up the EJBQL using the retrieved employees
    String ejbqlString = "SELECT OBJECT(emp) FROM Employee emp WHERE ";
    ejbqlString = ejbqlString + "?1 = emp.firstName ";

    setEjbqlString(ejbqlString);
    setOriginalOject(employees);

    setArguments(parameters);

    Vector myArgumentNames = new Vector();
    myArgumentNames.add("1");
    setArgumentNames(myArgumentNames);

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