예제 #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
 public TestMessage(TestMessage testMessage) {
   this.id = new Long(0);
   this.testCaseName = testMessage.testCaseName;
   this.hasTouched = testMessage.hasTouched;
   if (ConfigurationLocator.getJavalancheConfiguration().storeTestMessages()) {
     this.message = testMessage.message;
   }
   this.duration = 0;
   // this.duration = testMessage.duration;
 }
예제 #3
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();
  }
예제 #4
0
 public static MutationsForRun getFromDefaultLocation(boolean filter) {
   JavalancheConfiguration configuration = ConfigurationLocator.getJavalancheConfiguration();
   return new MutationsForRun(configuration.getMutationIdFile(), filter);
 }
예제 #5
0
 @AfterClass
 public static void tearDownClass() {
   ConfigurationLocator.setJavalancheConfiguration(configBack);
 }
예제 #6
0
 @BeforeClass
 public static void setUpClass() throws Exception {
   configBack = ConfigurationLocator.getJavalancheConfiguration();
   config = new JavalancheTestConfiguration();
   ConfigurationLocator.setJavalancheConfiguration(config);
 }