コード例 #1
0
ファイル: Scenario.java プロジェクト: siviotti/reqplay
 // ******************** Alternative ********************
 Scenario alternative(String id, String title, Scenario scenario, String action) {
   if (id == null) {
     id = "A" + (alternativeFlows.size() + 1);
   }
   currentAlternativeFlow = new AlternativeFlow(id, title, selectedSteps, action);
   currentFlow = currentAlternativeFlow;
   currentFlow.setPrefix(currentFlow.getId().concat("."));
   alternativeFlows.add(currentAlternativeFlow);
   selectedSteps.clear();
   return this;
 }
コード例 #2
0
ファイル: Scenario.java プロジェクト: siviotti/reqplay
 Scenario exception(String id, String title, Scenario scenario, Object... objects) {
   Condition condition = new Condition(objects);
   if (id == null) {
     id = "E" + (exceptionFlows.size() + 1);
   }
   currentExceptionFlow = new ExceptionFlow(id, title, selectedSteps, condition);
   currentFlow = currentExceptionFlow;
   currentFlow.setPrefix(currentFlow.getId().concat("."));
   exceptionFlows.add(currentExceptionFlow);
   selectedSteps.clear();
   return this;
 }
コード例 #3
0
ファイル: Scenario.java プロジェクト: siviotti/reqplay
 @Override
 public void afterPlay(ReqContext context) {
   super.afterPlay(context);
   ScenarioSpec spec = getClass().getAnnotation(ScenarioSpec.class);
   if (spec == null) {
     throw new ReqPlayException(
         "Scenarios must be annotated with @ScenarioSpec: " + getClass().getCanonicalName());
   }
   feature = (Feature) context.getAsFeature(spec.feature());
   if (actorClass != null) {
     primaryActor = (Actor) context.getAsActor(actorClass);
   }
   for (Class<?> c : actorClasses) {
     actors.add((Actor) context.getAsActor(c));
   }
   mainFlow.afterPlay(context);
   if (!alternativeFlows.isEmpty()) {
     for (AlternativeFlow flow : alternativeFlows) {
       flow.afterPlay(context);
     }
   }
   if (!exceptionFlows.isEmpty()) {
     for (ExceptionFlow flow : exceptionFlows) {
       flow.afterPlay(context);
     }
   }
   if (!extensionPoints.isEmpty()) {
     for (ExtensionPoint ep : extensionPoints) {
       ep.afterPlay(context);
     }
   }
 }
コード例 #4
0
ファイル: Scenario.java プロジェクト: siviotti/reqplay
 public Scenario orAt(String id) {
   if (selectedSteps.isEmpty()) {
     throw new ReqPlayException("Call at() before orAt()");
   }
   selectedSteps.add(mainFlow.get(id));
   return this;
 }
コード例 #5
0
ファイル: Scenario.java プロジェクト: siviotti/reqplay
 public StepAPI step(String id, Object... objects) {
   currentStep = currentFlow.add(id, objects);
   if (steps.containsKey(id)) {
     throw new ReqPlayException("Step already exists:" + id);
   }
   steps.put(currentStep.getId(), currentStep);
   return new StepAPI(currentStep);
 }
コード例 #6
0
ファイル: Scenario.java プロジェクト: siviotti/reqplay
 public Scenario at(String id) {
   selectedSteps.clear();
   selectedSteps.add(mainFlow.get(id));
   return this;
 }