private void execute(EventContext<? extends ExecutionEvent> context, String phase) {
   if (shouldPerformExecution(context.getEvent())) {
     context.proceed();
   } else {
     log.info("Ignore test [" + phase + "]: " + toFqn(context.getEvent()));
     testResultProducer.set(new TestResult(TestResult.Status.SKIPPED));
   }
 }
 private void createContext(EventContext<? extends TestEvent> context) {
   try {
     lookup(context.getEvent().getTestMethod(), new Activate());
     context.proceed();
   } finally {
     lookup(context.getEvent().getTestMethod(), new DeActivate());
   }
 }
  public void execute(@Observes(precedence = Integer.MAX_VALUE) EventContext<BeforeSuite> event)
      throws Exception {

    Bundle bundle = FrameworkUtil.getBundle(getClass());

    BundleContext bundleContext = bundle.getBundleContext();

    Filter filter =
        FrameworkUtil.createFilter(
            "(&(objectClass=org.springframework.context.ApplicationContext)"
                + "(org.springframework.context.service.name="
                + bundleContext.getBundle().getSymbolicName()
                + "))");

    ServiceTracker<ApplicationContext, ApplicationContext> serviceTracker =
        new ServiceTracker<>(bundleContext, filter, null);

    serviceTracker.open();

    try {
      serviceTracker.waitForService(30 * 1000L);
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }

    serviceTracker.close();

    event.proceed();
  }
  public void callback(@Observes EventContext<Test> eventContext) throws Exception {
    // first let the test run
    eventContext.proceed();
    // then verify that the test performed within the specified time
    verifyPerformance(eventContext.getEvent());
    // then compare with previous results

    PerformanceSuiteResult suiteResult = suiteResultInst.get();

    if (suiteResult != null) {
      try {
        comparePerformanceSuiteResults(
            suiteResult, eventContext.getEvent().getTestMethod().getName());
      } catch (PerformanceException pe) {
        TestResult result = testResultInst.get();
        if (result != null) {
          result.setThrowable(pe);
        }
      }
    }
  }