<commit_before>package com.yahoo.dtf.results;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URI;
import java.text.ParseException;
import java.util.Date;
import java.util.Iterator;
import java.util.Set;
import java.util.Map.Entry;

import com.yahoo.dtf.DTFProperties;
import com.yahoo.dtf.actions.Action;
import com.yahoo.dtf.exception.ResultsException;
import com.yahoo.dtf.exception.StorageException;
import com.yahoo.dtf.util.TimeUtil;

public class JUnitResults extends ResultsBase {

    private URI _uri = null;
    
    private PrintStream _xml = null;
    
    public JUnitResults(URI uri, boolean savelogs) {
        super(uri, true);
        _uri = uri;
    }
    
    public URI getURI() { return _uri; }

    public void start() throws ResultsException {
        try {
            OutputStream os = Action.getStorageFactory().getOutputStream(_uri);
            _xml = new PrintStream(os);
        } catch (StorageException e) {
            throw new ResultsException("Unable to open output file.",e);
        }
    }
    
    public void stop() throws ResultsException {
        _xml.close();
        
        /*
         * now lets beautify the resulting XML. 
         */
    }
  
    private void startTestSuite(Result result, PrintStream ps) throws ResultsException { 
        ps.print("<testsuite");
        ps.print(" name=\"" + result.getName() + "\"");
        ps.print(" classname=\"dtf." + result.getName() + "\"");
        ps.print(" tests=\"" + result.getTotalTests() + "\"");
        
        try { 
            ps.print(" start=\"" + TimeUtil.dateStampToDateStamp(result.getStart()) + "\"");
            ps.print(" stop=\"" + TimeUtil.dateStampToDateStamp(result.getStop()) + "\"");
        } catch (ParseException e) { 
            throw new ResultsException("Error handling date.",e);
        }
         
        ps.print(" time=\"" + result.getDurationInSeconds() + "\"");
        ps.print(" timestamp=\"" + new Date(result.getStart()) + "\"");
        ps.print(" passed=\"" + result.getNumPassed() + "\"");
        ps.print(" failures=\"" + result.getNumFailed() + "\"");
        ps.print(" errors=\"" + result.getNumFailed() + "\"");
        ps.println(" disabled=\"" + result.getNumSkipped() + "\">");
    }
    <commit_msg>- small fix to prefix dtf. to test suite name<commit_after>package com.yahoo.dtf.results;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URI;
import java.text.ParseException;
import java.util.Date;
import java.util.Iterator;
import java.util.Set;
import java.util.Map.Entry;

import com.yahoo.dtf.DTFProperties;
import com.yahoo.dtf.actions.Action;
import com.yahoo.dtf.exception.ResultsException;
import com.yahoo.dtf.exception.StorageException;
import com.yahoo.dtf.util.TimeUtil;

public class JUnitResults extends ResultsBase {

    private URI _uri = null;
    
    private PrintStream _xml = null;
    
    public JUnitResults(URI uri, boolean savelogs) {
        super(uri, true);
        _uri = uri;
    }
    
    public URI getURI() { return _uri; }

    public void start() throws ResultsException {
        try {
            OutputStream os = Action.getStorageFactory().getOutputStream(_uri);
            _xml = new PrintStream(os);
        } catch (StorageException e) {
            throw new ResultsException("Unable to open output file.",e);
        }
    }
    
    public void stop() throws ResultsException {
        _xml.close();
        
        /*
         * now lets beautify the resulting XML. 
         */
    }
  
    private void startTestSuite(Result result, PrintStream ps) throws ResultsException { 
        ps.print("<testsuite");
        ps.print(" name=\"dtf." + result.getName() + "\"");
        ps.print(" classname=\"dtf." + result.getName() + "\"");
        ps.print(" tests=\"" + result.getTotalTests() + "\"");
        
        try { 
            ps.print(" start=\"" + TimeUtil.dateStampToDateStamp(result.getStart()) + "\"");
            ps.print(" stop=\"" + TimeUtil.dateStampToDateStamp(result.getStop()) + "\"");
        } catch (ParseException e) { 
            throw new ResultsException("Error handling date.",e);
        }
         
        ps.print(" time=\"" + result.getDurationInSeconds() + "\"");
        ps.print(" timestamp=\"" + new Date(result.getStart()) + "\"");
        ps.print(" passed=\"" + result.getNumPassed() + "\"");
        ps.print(" failures=\"" + result.getNumFailed() + "\"");
        ps.print(" errors=\"" + result.getNumFailed() + "\"");
        ps.println(" disabled=\"" + result.getNumSkipped() + "\">");
    }
    
{'fraction_non_alphanumeric': 0.14989939637826963, 'fraction_numerical': 0.0, 'mean_word_length': 2.6311176040905773, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1684584', 'n_tokens_mistral': 1478, 'n_tokens_neox': 1452, 'n_words': 315}