public boolean isBuildUnstable() {
   for (Condition condition : simulation.getUnstableConditions()) {
     if (!condition.isFulfilledBy(globalReport)) {
       return true;
     }
   }
   return false;
 }
  private File locateStatsFile() throws IOException, InterruptedException {
    FilePath[] files = reportDirectory.list(STATS_FILE_PATTERN);

    if (files.length == 0)
      throw new FileNotFoundException(
          "Unable to locate the simulation results for " + simulation.getName());

    return new File(files[0].getRemote());
  }
  @Override
  public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener)
      throws InterruptedException, IOException {
    GatlingBuildAction action = new GatlingBuildAction(build);

    FilePath reportDirectory =
        saveFullReport(build.getWorkspace(), build.getRootDir(), simulation.getName());

    build.addAction(new GatlingReportAction(build, simulation.getName(), reportDirectory));

    SimulationReport report = new SimulationReport(reportDirectory, simulation);
    report.readStatsFile();

    if (report.isBuildFailed()) {
      build.setResult(Result.FAILURE);
    }
    if (report.isBuildUnstable()) {
      build.setResult(Result.UNSTABLE);
    }

    action.getRequestsReports().put(simulation.getName(), report.getGlobalReport());
    build.addAction(action);
    return true;
  }
 public List<Condition> getUnstableConditions() {
   return simulation.getUnstableConditions();
 }
 public List<Condition> getFailConditions() {
   return simulation.getFailConditions();
 }
 public String getSimulationPath() {
   return simulation.getName();
 }
 public boolean hasUnstableConditions() {
   return !simulation.getUnstableConditions().isEmpty();
 }
 public boolean hasFailConditions() {
   return !simulation.getFailConditions().isEmpty();
 }