Creates a statement that will execute {@code beforeClass) and {@code afterClass)

@param base
the base statement to be executed
@return
the statement for invoking beforeClass and afterClass
188733
private Statement classStatement(final Statement base) {
        return new Statement() {

            @Override
            public void evaluate() throws Throwable {
                beforeClass();
                doStateTransition(State.BEFORE_EXECUTED);
                try {
                    base.evaluate();
                } finally {
                    afterClass();
                    doStateTransition(State.AFTER_EXECUTED);
                }
            }
        };
    }
432868
@Override
    protected int beforeHandle(final Request request, final Response response)
    {
        this.log.debug("Calling isLoggingIn");
        if(this.isLoggingIn(request, response))
        {
            this.log.debug("Calling isLoggingIn");
            this.login(request, response);
            if(this.authenticate(request, response))
            {
                this.log.debug("Calling authenticated");
                this.authenticated(request, response);
            }
            // we redirect after logging in for all cases, so stop here and return the 303 response
            return Filter.STOP;
        }
        else if(this.isLoggingOut(request, response))
        {
            this.log.debug("Calling logout");
            return this.logout(request, response);
        }
        
        // log.info("calling super.beforeHandle");
        // return super.beforeHandle(request, response);
        
        this.log.debug("Calling copy of Authenticator beforeHandle");
        
        if(
        // FIXME: How important is multiAuthenticating to this class?
        // isMultiAuthenticating() ||
        !request.getClientInfo().isAuthenticated())
        {
            this.log.debug("Calling authenticate");
            if(this.authenticate(request, response))
            {
                this.log.debug("Calling authenticated");
                return this.authenticated(request, response);
            }
            else if(this.isOptional())
            {
                this.log.debug("Authentication isOptional, returning CONTINUE with Status.SUCCESS_OK");
                response.setStatus(Status.SUCCESS_OK);
                return Filter.CONTINUE;
            }
            else
            {
                this.log.debug("Calling unauthenticated");
                return this.unauthenticated(request, response);
            }
        }
        else
        {
            this.log.debug("Returning CONTINUE");
            return Filter.CONTINUE;
        }
    }
320888
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
  {
    if (!m_doneEval) 
    {
      this.m_transformer.getMsgMgr().error      
        (xctxt.getSAXLocator(), XSLTErrorResources.ER_REFERENCING_ITSELF, 
          new Object[]{((ElemVariable)this.object()).getName().getLocalName()}); 
    }
    VariableStack vars = xctxt.getVarStack();
    
    // These three statements need to be combined into one operation.
    int currentFrame = vars.getStackFrame();
    //// vars.setStackFrame(m_varStackPos);
   

    ElemVariable velem = (ElemVariable)m_obj;
    try
    {
      m_doneEval = false;
      if(-1 != velem.m_frameSize)
      	vars.link(velem.m_frameSize);
      XObject var = velem.getValue(m_transformer, m_context);
      m_doneEval = true;
      return var;
    }
    finally
    {
      // These two statements need to be combined into one operation.
      // vars.setStackFrame(currentFrame);
      
      if(-1 != velem.m_frameSize)
	  	vars.unlink(currentFrame);
    }
  }
675862
private boolean generateOnCreate(SQLiteDatabaseSchema schema, List<SQLiteEntity> orderedEntities) {
		boolean useForeignKey = false;
		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("onCreate").addAnnotation(Override.class)
				.addModifiers(Modifier.PUBLIC);
		methodBuilder.addParameter(SQLiteDatabase.class, "database");
		methodBuilder.addJavadoc("onCreate\n");
		methodBuilder.addCode("// generate tables\n");
		if (schema.isLogEnabled()) {
			// generate log section - BEGIN
			methodBuilder.addComment("log section create BEGIN");
			methodBuilder.beginControlFlow("if (this.logEnabled)");

			methodBuilder.beginControlFlow("if (options.inMemory)");
			methodBuilder.addStatement("$T.info(\"Create database in memory\")", Logger.class);
			methodBuilder.nextControlFlow("else");
			methodBuilder.addStatement("$T.info(\"Create database '%s' version %s\",this.name, this.version)",
					Logger.class);
			methodBuilder.endControlFlow();

			// generate log section - END
			methodBuilder.endControlFlow();
			methodBuilder.addComment("log section create END");
		}
		for (SQLiteEntity item : orderedEntities) {
			if (schema.isLogEnabled()) {
				// generate log section - BEGIN
				methodBuilder.addComment("log section create BEGIN");
				methodBuilder.beginControlFlow("if (this.logEnabled)");

				methodBuilder.addStatement("$T.info(\"DDL: %s\",$T.CREATE_TABLE_SQL)", Logger.class,
						BindTableGenerator.tableClassName(null, item));

				// generate log section - END
				methodBuilder.endControlFlow();
				methodBuilder.addComment("log section create END");
			}
			methodBuilder.addStatement("database.execSQL($T.CREATE_TABLE_SQL)",
					BindTableGenerator.tableClassName(null, item));

			if (item.referedEntities.size() > 0) {
				useForeignKey = true;
			}
		}

		// use generated entities too
		// if we have generated entities, we use foreign key for sure
		if (schema.generatedEntities.size() > 0)
			useForeignKey = true;
		for (GeneratedTypeElement item : schema.generatedEntities) {
			if (schema.isLogEnabled()) {
				// generate log section - BEGIN
				methodBuilder.addComment("log section BEGIN");
				methodBuilder.beginControlFlow("if (this.logEnabled)");

				methodBuilder.addStatement("$T.info(\"DDL: %s\",$T.CREATE_TABLE_SQL)", Logger.class,
						TypeUtility.className(BindTableGenerator.getTableClassName(item.getQualifiedName())));

				// generate log section - END
				methodBuilder.endControlFlow();
				methodBuilder.addComment("log section END");
			}
			methodBuilder.addStatement("database.execSQL($T.CREATE_TABLE_SQL)",
					TypeUtility.className(BindTableGenerator.getTableClassName(item.getQualifiedName())));

		}

		methodBuilder.beginControlFlow("if (options.databaseLifecycleHandler != null)");
		methodBuilder.addStatement("options.databaseLifecycleHandler.onCreate(database)");
		methodBuilder.endControlFlow();

		methodBuilder.addStatement("justCreated=true");

		classBuilder.addMethod(methodBuilder.build());

		return useForeignKey;
	}
364052
private Map<Class<?>, Object> executeBeforeBenchClass(
			final Map<Class<?>, Object> instantiatedObj,
			final BenchmarkResult res) {

		final Map<Class<?>, Object> returnVal = new Hashtable<Class<?>, Object>();

		// invoking before bench class
		for (final Class<?> clazz : instantiatedObj.keySet()) {

			final Object objectToUse = instantiatedObj.get(clazz);
			// ..the search for the beforeClassMeth begins...
			Method beforeClassMeth = null;
			boolean continueVal = true;
			try {
				beforeClassMeth = BenchmarkMethod
						.findAndCheckAnyMethodByAnnotation(clazz,
								BeforeBenchClass.class);
				// ... and if this search is throwing an exception, the
				// exception will be added and a flag is set to break up
			} catch (final PerfidixMethodCheckException e) {
				res.addException(e);
				continueVal = false;
			}
			// if everything worked well...
			if (continueVal) {
				if (beforeClassMeth == null) {
					// ...either the objects is directly mapped to the class
					// for executing the benches
					returnVal.put(clazz, objectToUse);
				} else {
					// ... or the beforeMethod will be executed and a
					// possible exception stored to the result...
					final PerfidixMethodCheckException beforeByCheck = BenchmarkExecutor
							.checkMethod(objectToUse, BeforeBenchClass.class,
									beforeClassMeth);
					if (beforeByCheck == null) {
						final PerfidixMethodInvocationException beforeByInvok = BenchmarkExecutor
								.invokeMethod(objectToUse,
										BeforeBenchClass.class, beforeClassMeth);
						if (beforeByInvok == null) {
							returnVal.put(clazz, objectToUse);
						} else {
							res.addException(beforeByInvok);
						}
					} else {
						res.addException(beforeByCheck);
					}
				}
			}
		}
		return returnVal;
	}
379374
@Override
	public Element execute(Context context) {

		assert (ops.length == 2 || ops.length == 3);

		// Pop the condition from the data stack.
		boolean condition = false;
		try {
			condition = ((BooleanProperty) ops[0].execute(context)).getValue();
		} catch (ClassCastException cce) {
			throw new EvaluationException(MessageUtils
					.format(MSG_INVALID_IF_ELSE_TEST), sourceRange);
		}

		// Choose the correct operation and execute it.
		Operation op = null;
		if (condition) {
			op = ops[1];
		} else if (ops.length > 2) {
			op = ops[2];
		} else {
			op = Undef.VALUE;
		}
		return op.execute(context);
	}
317394
public static void before(Object request, Object response) {
        /*
         * Use reflection to access the HttpServletRequest/Response as using the
         * true method signature caused ClassLoader issues.
         */
        Class<?> reqClass = request.getClass();
        try {
            /*
             * Retrieve the tracker from the request and increment nesting level
             */
            HttpRequestTracker tracker;
            Method getAttribute = reqClass.getMethod(GET_ATTRIBUTE, String.class);
            tracker = (HttpRequestTracker) (getAttribute.invoke(request, TRACKER_ATTRIBUTE));
            if (tracker == null) {
                tracker = new HttpRequestTracker();
            }
            tracker.increment();
            Method setAttribute = reqClass.getMethod(SET_ATTRIBUTE, String.class, Object.class);
            setAttribute.invoke(request, TRACKER_ATTRIBUTE, tracker);
        } catch (Exception e) {
            // Log any exception caused by our injected code
            System.err.println("Javametrics: Servlet callback exception: " + e.toString());
            e.printStackTrace();
        }
    }
752183
@Override
    public Statement apply(final Statement base, final Description description) {
        if (description.isSuite()) {
            return super.apply(classStatement(base), description);
        }
        return super.apply(statement(base), description);
    }
583727
public static JCMethodInvocation firstConstructorCall(JCTree tree) {
        if (!tree.hasTag(METHODDEF)) return null;
        JCMethodDecl md = (JCMethodDecl) tree;
        Names names = md.name.table.names;
        if (md.name != names.init) return null;
        if (md.body == null) return null;
        List<JCStatement> stats = md.body.stats;
        // Synthetic initializations can appear before the super call.
        while (stats.nonEmpty() && isSyntheticInit(stats.head))
            stats = stats.tail;
        if (stats.isEmpty()) return null;
        if (!stats.head.hasTag(EXEC)) return null;
        JCExpressionStatement exec = (JCExpressionStatement) stats.head;
        if (!exec.expr.hasTag(APPLY)) return null;
        return (JCMethodInvocation)exec.expr;
    }
881352
function BaseStatement(
    statementOptions, context, services, connectionConfig)
{
  // call super
  EventEmitter.call(this);

  // validate input
  Errors.assertInternal(Util.isObject(statementOptions));
  Errors.assertInternal(Util.isObject(context));

  context.services         = services;
  context.connectionConfig = connectionConfig;
  context.isFetchingResult = true;

  // TODO: add the parameters map to the statement context

  var statement = this;

  /**
   * Returns this statement's SQL text.
   *
   * @returns {String}
   */
  this.getSqlText = function()
  {
    return context.sqlText;
  };

  /**
   * Returns the current status of this statement.
   *
   * @returns {String}
   */
  this.getStatus = function()
  {
    return context.isFetchingResult ? states.FETCHING : states.COMPLETE;
  };

  /**
   * Returns the columns produced by this statement.
   *
   * @returns {Object[]}
   */
  this.getColumns = function()
  {
    return context.result ? context.result.getColumns() : undefined;
  };

  /**
   * Given a column identifier, returns the corresponding column. The column
   * identifier can be either the column name (String) or the column index
   * (Number). If a column is specified and there is more than one column with
   * that name, the first column with the specified name will be returned.
   *
   * @param {String | Number} columnIdentifier
   *
   * @returns {Object}
   */
  this.getColumn = function(columnIdentifier)
  {
    return context.result ? context.result.getColumn(columnIdentifier) :
        undefined;
  };

  /**
   * Returns the number of rows returned by this statement.
   *
   * @returns {Number}
   */
  this.getNumRows = function()
  {
    return context.result ? context.result.getReturnedRows() : undefined;
  };

  /**
   * Returns the number of rows updated by this statement.
   *
   * @returns {Number}
   */
  this.getNumUpdatedRows = function()
  {
    return context.result ? context.result.getNumUpdatedRows() : undefined;
  };

  /**
   * Returns an object that contains information about the values of the
   * current warehouse, current database, etc., when this statement finished
   * executing.
   *
   * @returns {Object}
   */
  this.getSessionState = function()
  {
    return context.result ? context.result.getSessionState() : undefined;
  };

  /**
   * Returns the request id that was used when the statement was issued.
   *
   * @returns {String}
   */
  this.getRequestId = function()
  {
    return context.requestId;
  };

  /**
   * Returns the statement id generated by the server for this statement.
   * If the statement is still executing and we don't know the statement id
   * yet, this method will return undefined.
   *
   * @returns {String}
   */
  this.getStatementId = function()
  {
    return context.statementId;
  };

  /**
   * Cancels this statement if possible.
   *
   * @param {Function} [callback]
   */
  this.cancel = function(callback)
  {
    sendCancelStatement(context, statement, callback);
  };

  /**
   * Issues a request to get the statement result again.
   *
   * @param {Function} callback
   */
  context.refresh = function(callback)
  {
    // pick the appropriate function to get the result based on whether we
    // have the statement id or request id (we should have at least one)
    var sendRequestFn = context.statementId ?
        sendRequestPostExec : sendRequestPreExec;

    // the current result error might be transient,
    // so issue a request to get the result again
    sendRequestFn(context, function(err, body)
    {
      // refresh the result
      context.onStatementRequestComp(err, body);

      // if a callback was specified, invoke it
      if (Util.isFunction(callback))
      {
        callback(context);
      }
    });
  };

  /**
   * Called when the statement request is complete.
   *
   * @param err
   * @param body
   */
  context.onStatementRequestComp = function(err, body)
  {
    // if we already have a result or a result error, we invoked the complete
    // callback once, so don't invoke it again
    var suppressComplete = context.result || context.resultError;

    // clear the previous result error
    context.resultError = null;

    // if there was no error, call the success function
    if (!err)
    {
      context.onStatementRequestSucc(body);
    }
    else
    {
      // save the error
      context.resultError = err;

      // if we don't have a statement id and we got a response from GS, extract
      // the statement id from the data
      if (!context.statementId &&
          Errors.isOperationFailedError(err) && err.data)
      {
        context.statementId = err.data.queryId;
      }
    }

    // we're no longer fetching the result
    context.isFetchingResult = false;

    if (!suppressComplete)
    {
      // emit a complete event
      context.emit('statement-complete', Errors.externalize(err), statement);

      // if a complete function was specified, invoke it
      if (Util.exists(context.complete))
      {
        invokeStatementComplete(statement, context);
      }
    }
    else
    {
      Logger.getInstance().debug('refreshed result of statement with %s',
          context.requestId ?
              Util.format('request id = %s', context.requestId) :
              Util.format('statement id = %s', context.statementId));
    }
  };

  /**
   * Called when the statement request is successful. Subclasses must provide
   * their own implementation.
   *
   * @param {Object} body
   */
  context.onStatementRequestSucc = function(body){};
}
504220
public void executeBeforeClass(@Observes BeforeClass event, TestClass testClass){
		testClass = event.getTestClass();
		Field[] fields = testClass.getJavaClass().getDeclaredFields();
		for (Field field : fields) {
			if (field.isAnnotationPresent(GetDeployableContainer.class)){
				if (field.getType().isAssignableFrom(ContainerManagerTool.class)){
					isGetDeployableContainerAnnoPresent = true;
					deployableContainerFields.add(field);
				}
			}
		}
	}
494027
@Override
    public Statement createStatement() throws SQLException
    {
        checkClosed();
        try
        {
            return new JDBC4Statement(this);
        }
        catch(Exception x)
        {
            throw SQLError.get(x);
        }
    }
171821
public void beforeSuite(String suiteName, String ... testGroups) {
        testSuiteListener.onStart();

        if (!CollectionUtils.isEmpty(beforeSuite)) {
            for (SequenceBeforeSuite sequenceBeforeSuite : beforeSuite) {
                try {
                    if (sequenceBeforeSuite.shouldExecute(suiteName, testGroups)) {
                        sequenceBeforeSuite.execute(createTestContext());
                    }
                } catch (Exception e) {
                    testSuiteListener.onStartFailure(e);
                    afterSuite(suiteName, testGroups);

                    throw new AssertionError("Before suite failed with errors", e);
                }
            }

            testSuiteListener.onStartSuccess();
        } else {
            testSuiteListener.onStartSuccess();
        }
    }
44905
public List<JsonObject> executeStatement(String statement) {
        SimpleN1qlQuery query = N1qlQuery.simple(statement);
        return executeQuery(query);
    }
885118
public AnimaQuery<T> and(String statement, Object value) {
        return this.where(statement, value);
    }
1041321
@Override
    public Object executeWithArgs(ExecutionType executionType, Object[] args) throws CommandActionExecutionException {
        if(ExecutionType.ASYNCHRONOUS == executionType){
            Closure closure = AsyncClosureFactory.getInstance().createClosure(metaHolder, method, object, args);
            return executeClj(closure.getClosureObj(), closure.getClosureMethod());
        }

        return execute(object, method, args);
    }
1230471
@Override
    public void before(final Method method, final Object[] params, final Object arg2) throws Throwable {
        AuditManager.getInstance().audit(method.getClass(), method, params);
    }