Beispiel #1
0
  private void executeCheck() throws MojoExecutionException {
    final IBundleCoverage bundle = loadBundle();
    violations = false;

    final RulesChecker checker = new RulesChecker();
    final List<Rule> checkerrules = new ArrayList<Rule>();
    for (final RuleConfiguration r : rules) {
      checkerrules.add(r.rule);
    }
    checker.setRules(checkerrules);

    final IReportVisitor visitor = checker.createVisitor(this);
    try {
      visitor.visitBundle(bundle, null);
    } catch (final IOException e) {
      throw new MojoExecutionException("Error while checking code coverage: " + e.getMessage(), e);
    }
    if (violations) {
      if (this.haltOnFailure) {
        throw new MojoExecutionException(CHECK_FAILED);
      } else {
        this.getLog().warn(CHECK_FAILED);
      }
    } else {
      this.getLog().info(CHECK_SUCCESS);
    }
  }