org.chorusbdd.chorus.annotations.Handler类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.chorusbdd.chorus.annotations.Handler类的一些代码示例,展示了Handler类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Handler类的具体详情如下:
包路径:org.chorusbdd.chorus.annotations.Handler
类名称:Handler

Handler介绍

暂无

代码示例

代码示例来源:origin: Chorus-bdd/Chorus

@Handler(value = "Timers", scope = Scope.FEATURE)
@SuppressWarnings("UnusedDeclaration")
public class TimersHandler {

代码示例来源:origin: Chorus-bdd/Chorus

public void createFeatureScopedHandlers() throws Exception {
  for (Class handlerClass : orderedHandlerClasses) {
    //create a new SCENARIO scoped handler
    Handler handlerAnnotation = (Handler) handlerClass.getAnnotation(Handler.class);
    if (handlerAnnotation.scope() != Scope.SCENARIO) { //feature or unmanaged
      Object handler = createAndInitHandlerInstance(handlerClass);
      featureScopedHandlers.put(handlerClass, handler);
      log.debug("Created new feature scoped handler: " + handlerAnnotation.value());
    }
  }    
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Create a StepInvoker from an instance of a class annotated with @Handler
 * @param handlerInstance
 */
public HandlerClassInvokerFactory(Object handlerInstance) {
  Objects.requireNonNull(handlerInstance, "Handler instance cannot be null");
  this.handlerInstance = handlerInstance;
  Class<?> handlerClazz = handlerInstance.getClass();
  Handler handlerAnnotation = handlerClazz.getAnnotation(Handler.class);
  this.handlerName = handlerAnnotation == null ? handlerClazz.getName() : handlerAnnotation.value();
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Scope is starting, perform the required processing on the supplied handlers.
 */
public void processStartOfScope(Scope scopeStarting, Iterable<Object> handlerInstances) throws Exception {
  for (Object handler : handlerInstances) {
    Handler handlerAnnotation = handler.getClass().getAnnotation(Handler.class);
    Scope handlerScope = handlerAnnotation.scope();
    injectResourceFieldsForScope(scopeStarting, handler, handlerScope, handlerInstances);
    runLifecycleMethods(handler, handlerScope, scopeStarting, false);
  }    
}

代码示例来源:origin: Chorus-bdd/Chorus

private Object getHandlerResource(String resourceName, Iterable<Object> handlerInstances) {
  Object o = null;
  String handlerName = resourceName.substring(ChorusResource.handlerPrefix.length());
  for ( Object handlerInstance : handlerInstances) {
    Handler h = handlerInstance.getClass().getAnnotation(Handler.class);
    if ( handlerName.trim().toLowerCase().equals(h.value().trim().toLowerCase())) {
      o = handlerInstance;
      break;
    }
  }
  if ( o == null) {
    log.warn("Could not find a handler named " + handlerName +
        " to inject field annotated @ChorusResource(\"handler." + handlerName + "\", missing Uses: statement?");
  }
  return o;
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Scope is ending, perform the required processing on the supplied handlers.
 */
public void processEndOfScope(Scope scopeEnding, Iterable<Object> handlerInstances) throws Exception {
  for (Object handler : handlerInstances) {
    Handler handlerAnnotation = handler.getClass().getAnnotation(Handler.class);
    Scope scope = handlerAnnotation.scope();
    runLifecycleMethods(handler, scope, scopeEnding, true);
    //dispose handler instances with a scope which matches the scopeEnding
    if (scope == scopeEnding) {
      disposeSpringResources(handler, scopeEnding);
    }
  }
}

代码示例来源:origin: Chorus-bdd/Chorus

@Handler("Web Agent Self Test")
public class WebAgentSelfTestHandler {

代码示例来源:origin: Chorus-bdd/Chorus

for (Class handlerClass : classes) {
  Handler f = (Handler) handlerClass.getAnnotation(Handler.class);
  String handlerName = f.value();
  if (handlerNameToHandlerClass.containsKey(handlerName)) {
    String currentHandler = handlerNameToHandlerClass.get(handlerName).getName();

代码示例来源:origin: Chorus-bdd/Chorus

public List<Object> getOrCreateHandlersForScenario() throws Exception {
  List<Object> handlerInstances = new ArrayList<>();
  
  for ( Class handlerClass : orderedHandlerClasses ) {
    Handler handlerAnnotation = (Handler) handlerClass.getAnnotation(Handler.class);
    if ( handlerAnnotation.scope() != Scope.SCENARIO ) {
      Object handler = featureScopedHandlers.get(handlerClass);
      assert(handler != null); //must have been created during createFeatureScopedHandlers
      log.debug("Adding feature scoped handler " + handler + " class " + handlerClass);
      handlerInstances.add(handler);
    } else {
      log.debug("Creating scenario scoped handler " + handlerClass);
      Object handler = createAndInitHandlerInstance(handlerClass);
      handlerInstances.add(handler);
    }
  }
  return handlerInstances;
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Created by IntelliJ IDEA.
 * User: Nick Ebbutt
 * Date: 14/06/12
 * Time: 09:21
 */
@Handler("Start A Process With Classpath")
public class ProcessWithClasspathHandler extends ChorusAssert {

  @Step("Chorus is working properly")
  public void isWorkingProperly() {

  }
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Created by IntelliJ IDEA.
 * User: Nick Ebbutt
 * Date: 14/06/12
 * Time: 09:21
 */
@Handler("Process With Configurations")
public class ProcessWithConfigurationsHandler extends ChorusAssert {

  @Step("Chorus is working properly")
  public void isWorkingProperly() {

  }
}

代码示例来源:origin: Chorus-bdd/Chorus

@Handler("Test Step Publisher Handler")
public static class MockHandler {
  @Step(value = "call a test step", id = "step1")
  public void callATestStep() {
    System.out.println("Hello!");
    stepCalled.set(true);
  }
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Created by IntelliJ IDEA.
 * User: Nick Ebbutt
 * Date: 14/06/12
 * Time: 09:21
 */
@Handler("Feature Parsing")
public class FeatureParsingHandler {

  @Step("Chorus is working properly")
  public void isWorkingProperly() {
  }
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Created by IntelliJ IDEA.
 * User: Nick Ebbutt
 * Date: 14/06/12
 * Time: 09:21
 */
@Handler("Start A Process Without Logging")
public class StartAProcessHandler extends ChorusAssert {

  @Step("Chorus is working properly")
  public void isWorkingProperly() {

  }

}

代码示例来源:origin: Chorus-bdd/Chorus

@Handler("DynamicProcessHandler")
public static class DynamicProcessHandler {
  @Step(".*call an exported method")
  public String callMethod() {
    return "dumbledore";
  }
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Created by IntelliJ IDEA.
 * User: Nick Ebbutt
 * Date: 14/06/12
 * Time: 09:21
 */
@Handler("Default Properties")
public class DefaultPropertiesHandler extends ChorusAssert {

  @Step("call a remote method")
  public String callARemoteMethod() {
    return "true";
  }
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Created by IntelliJ IDEA.
 * User: Nick Ebbutt
 * Date: 14/06/12
 * Time: 09:21
 */
@Handler("JMX With Configurations")
public class JmxWithConfigurationsHandler extends ChorusAssert {

  @Step("I can call a step method exported by the handler")
  public void canCallAMethod() {
  }
}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Created by IntelliJ IDEA.
 * User: Nick Ebbutt
 * Date: 14/06/12
 * Time: 09:21
 */
@Handler("Feature Scoped Process")
public class FeatureScopedProcessHandler extends ChorusAssert {

  @Step(".*say hello")
  public void isWorkingProperly() {
    
  }

}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Created by IntelliJ IDEA.
 * User: Nick Ebbutt
 * Date: 14/06/12
 * Time: 09:21
 */
@Handler("Check Running")
public class CheckRunningHandler extends ChorusAssert {

  @Step("Chorus is working properly")
  public void isWorkingProperly() {

  }

}

代码示例来源:origin: Chorus-bdd/Chorus

/**
 * Created by IntelliJ IDEA.
 * User: Nick Ebbutt
 * Date: 14/06/12
 * Time: 09:21
 */
@Handler("Remoting Handler For Export")
public class RemotingHandlerForExport extends ChorusAssert {

  @Step("I can call a step method exported by the handler")
  public void canCallAMethod() {
  }
}

相关文章

微信公众号

最新文章

更多