<commit_before>package uk.co.automatictester.lightning.runners;

import uk.co.automatictester.lightning.JMeterTransactions;
import uk.co.automatictester.lightning.TestSet;
import uk.co.automatictester.lightning.ci.JenkinsReporter;
import uk.co.automatictester.lightning.ci.TeamCityReporter;
import uk.co.automatictester.lightning.enums.CIServer;
import uk.co.automatictester.lightning.enums.Mode;
import uk.co.automatictester.lightning.readers.JMeterCSVFileReader;
import uk.co.automatictester.lightning.reporters.JMeterReporter;
import uk.co.automatictester.lightning.reporters.TestSetReporter;

public class ApiTestRunner {

    private int exitCode = 0;
    private TestSet testSet;
    private JMeterTransactions jmeterTransactions;
    private String jmeterCsvFile;
    private Mode mode;
    private CIServer ciServer;

    public ApiTestRunner(Mode mode, String jmeterCsvFile) {
        this.mode = mode;
        this.jmeterCsvFile = jmeterCsvFile;
    }

    public ApiTestRunner(Mode mode, String jmeterCsvFile, TestSet testSet) {
        this(mode, jmeterCsvFile);
        this.testSet = testSet;
    }

    public void setCiServer(CIServer ciServer) {
        this.ciServer = ciServer;
    }

    public void run() {
        switch (mode) {
            case VERIFY:
                runTests();
                break;

            case REPORT:
                runReport();
                break;
        }
        if (ciServer != null) {
            notifyCIServer();
        }
    }

    public int getExitCode() {
        return exitCode;
    }

    private void runTests() {
        long testSetExecStart = System.currentTimeMillis();

        jmeterTransactions = new JMeterCSVFileReader().getTransactions(jmeterCsvFile);
        testSet.execute(jmeterTransactions);

        new TestSetReporter(testSet).printTestSetExecutionSummaryReport();

        long testSetExecEnd = System.currentTimeMillis();
        long testExecTime = testSetExecEnd - testSetExecStart;
        System.out.println(String.format("Execution time:    %dms", testExecTime));

        if (testSet.getFailCount() + testSet.getIgnoreCount() != 0) {
            exitCode = 1;
        }
    }<commit_msg>Amend ApiTestRunner constructors<commit_after>package uk.co.automatictester.lightning.runners;

import uk.co.automatictester.lightning.JMeterTransactions;
import uk.co.automatictester.lightning.TestSet;
import uk.co.automatictester.lightning.ci.JenkinsReporter;
import uk.co.automatictester.lightning.ci.TeamCityReporter;
import uk.co.automatictester.lightning.enums.CIServer;
import uk.co.automatictester.lightning.enums.Mode;
import uk.co.automatictester.lightning.readers.JMeterCSVFileReader;
import uk.co.automatictester.lightning.reporters.JMeterReporter;
import uk.co.automatictester.lightning.reporters.TestSetReporter;

public class ApiTestRunner {

    private int exitCode = 0;
    private TestSet testSet;
    private JMeterTransactions jmeterTransactions;
    private String jmeterCsvFile;
    private Mode mode;
    private CIServer ciServer;

    public ApiTestRunner(String jmeterCsvFile) {
        this.mode = Mode.REPORT;
        this.jmeterCsvFile = jmeterCsvFile;
    }

    public ApiTestRunner(String jmeterCsvFile, TestSet testSet) {
        this.mode = Mode.VERIFY;
        this.jmeterCsvFile = jmeterCsvFile;
        this.testSet = testSet;
    }

    public void setCiServer(CIServer ciServer) {
        this.ciServer = ciServer;
    }

    public void run() {
        switch (mode) {
            case VERIFY:
                runTests();
                break;

            case REPORT:
                runReport();
                break;
        }
        if (ciServer != null) {
            notifyCIServer();
        }
    }

    private void runTests() {
        long testSetExecStart = System.currentTimeMillis();

        jmeterTransactions = new JMeterCSVFileReader().getTransactions(jmeterCsvFile);
        testSet.execute(jmeterTransactions);

        new TestSetReporter(testSet).printTestSetExecutionSummaryReport();

        long testSetExecEnd = System.currentTimeMillis();
        long testExecTime = testSetExecEnd - testSetExecStart;
        System.out.println(String.format("Execution time:    %dms", testExecTime));

        if (testSet.getFailCount() + testSet.getIgnoreCount() != 0) {
            exitCode = 1;
        }
    }
{'fraction_non_alphanumeric': 0.08790452145972, 'fraction_numerical': 0.001377094330961671, 'mean_word_length': 2.8806767586821014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3635223', 'n_tokens_mistral': 1385, 'n_tokens_neox': 1314, 'n_words': 233}