Пример #1
0
 /**
  * Analyzes the mutation results for a project
  *
  * @param analyzers the mutationAnalyzers to use
  */
 public static void analyzeMutations(List<MutationAnalyzer> analyzers) {
   JavalancheConfiguration javalancheConfiguration =
       ConfigurationLocator.getJavalancheConfiguration();
   String prefix = javalancheConfiguration.getProjectPrefix();
   if (prefix == null) {
     throw new RuntimeException("no prefix set");
   }
   analyzeMutations(analyzers, prefix);
 }
Пример #2
0
  /**
   * Analyzes the mutation results for a project.
   *
   * @param mutationResultAnalyzers the mutationAnalyzers to use
   * @param analyzers
   * @param prefix the prefix for the mutations to analyze
   */
  @SuppressWarnings("unchecked")
  private static void analyzeMutations(List<MutationAnalyzer> analyzers, String prefix) {
    Session session = HibernateUtil.openSession();
    // Session session =
    // HibernateServerUtil.getSessionFactory(Server.KUBRICK).openSession();
    Transaction tx = session.beginTransaction();
    Query query = session.createQuery("FROM Mutation WHERE className LIKE '" + prefix + "%'");
    @SuppressWarnings("unchecked")
    List<Mutation> mutations = query.list();
    HtmlReport report = new HtmlAnalyzer().analyze(mutations);
    StringBuilder sb = new StringBuilder();
    sb.append("--------------------------------------------------------------------------------\n");

    for (MutationAnalyzer mutationAnalyzer : analyzers) {

      String analyzeResult = mutationAnalyzer.analyze(mutations, report);

      String str = "Results from " + mutationAnalyzer.getClass().getName() + "\n";
      report.addSummary(str, analyzeResult);
      sb.append(str);
      sb.append(analyzeResult);
      sb.append(
          "\n--------------------------------------------------------------------------------\n");
    }
    long l = getNumberOfMutationsWithoutResult(session, prefix);
    JavalancheConfiguration javalancheConfiguration =
        ConfigurationLocator.getJavalancheConfiguration();
    System.out.println(
        "Analyzed Results for mutations with prefix: "
            + javalancheConfiguration.getProjectPrefix());
    System.out.println("No results for " + l + " mutations");
    System.out.println(sb.toString());
    report.report();
    tx.commit();
    session.close();
  }
Пример #3
0
 public static MutationsForRun getFromDefaultLocation(boolean filter) {
   JavalancheConfiguration configuration = ConfigurationLocator.getJavalancheConfiguration();
   return new MutationsForRun(configuration.getMutationIdFile(), filter);
 }