Search in sources :

Example 21 with Kopemedata

use of de.dagere.kopeme.generated.Kopemedata in project peass by DaGeRe.

the class IsChange method call.

@Override
public Integer call() throws Exception {
    LOG.debug("Checking: {}", dataFolder);
    final File xmlFile = dataFolder.listFiles((FilenameFilter) new WildcardFileFilter("*.xml"))[0];
    final Kopemedata data = new XMLDataLoader(xmlFile).getFullData();
    final Chunk chunk = data.getTestcases().getTestcase().get(0).getDatacollector().get(0).getChunk().get(0);
    final String[] versions = KoPeMeDataHelper.getVersions(chunk);
    LOG.debug(versions[1]);
    final DescribedChunk describedChunk = new DescribedChunk(chunk, versions[0], versions[1]);
    final boolean change = describedChunk.getStatistic(statisticConfigMixin.getStasticsConfig()).isChange();
    LOG.info("Change: {}", change);
    // TODO Auto-generated method stub
    return change ? 1 : 0;
}
Also used : FilenameFilter(java.io.FilenameFilter) XMLDataLoader(de.dagere.kopeme.datastorage.XMLDataLoader) DescribedChunk(de.dagere.peass.measurement.statistics.data.DescribedChunk) Kopemedata(de.dagere.kopeme.generated.Kopemedata) DescribedChunk(de.dagere.peass.measurement.statistics.data.DescribedChunk) Chunk(de.dagere.kopeme.generated.TestcaseType.Datacollector.Chunk) File(java.io.File) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter)

Example 22 with Kopemedata

use of de.dagere.kopeme.generated.Kopemedata in project peass by DaGeRe.

the class Cleaner method handleChunk.

private void handleChunk(final Entry<String, EvaluationPair> entry, TestCase testcase, final Chunk currentChunk) {
    try {
        final MeasurementFileFinder finder = new MeasurementFileFinder(cleanFolder, testcase);
        final File measurementFile = finder.getMeasurementFile();
        final Kopemedata oneResultData = finder.getOneResultData();
        Datacollector datacollector = finder.getDataCollector();
        if (checkChunk(currentChunk)) {
            datacollector.getChunk().add(currentChunk);
            XMLDataStorer.storeData(measurementFile, oneResultData);
            correct++;
        } else {
            printFailureInfo(entry, currentChunk, measurementFile);
        }
    } catch (final JAXBException e) {
        e.printStackTrace();
    }
}
Also used : MeasurementFileFinder(de.dagere.peass.measurement.dataloading.MeasurementFileFinder) Datacollector(de.dagere.kopeme.generated.TestcaseType.Datacollector) JAXBException(javax.xml.bind.JAXBException) Kopemedata(de.dagere.kopeme.generated.Kopemedata) File(java.io.File)

Example 23 with Kopemedata

use of de.dagere.kopeme.generated.Kopemedata in project peass by DaGeRe.

the class DataReader method readMeasurementFile.

private static void readMeasurementFile(final Map<String, TestData> currentMeasurement, final File versionOfPair, final File versionCurrent, final File measurementFile) {
    try {
        final Kopemedata resultData = new XMLDataLoader(measurementFile).getFullData();
        final String testclazz = resultData.getTestcases().getClazz();
        TestCase testcase = new TestCase(resultData.getTestcases());
        TestData testData = currentMeasurement.get(testcase.getMethodWithParams());
        if (testData == null) {
            final File originFile = measurementFile.getParentFile().getParentFile().getParentFile().getParentFile().getParentFile().getParentFile().getParentFile();
            testData = new TestData(testcase, originFile);
            currentMeasurement.put(testcase.getMethodWithParams(), testData);
        }
        String predecessor = null;
        final File[] versionFiles = versionOfPair.listFiles();
        for (final File version : versionFiles) {
            if (!version.getName().equals(versionOfPair.getName())) {
                predecessor = version.getName();
            }
        }
        if (predecessor != null) {
            testData.addMeasurement(versionOfPair.getName(), versionCurrent.getName(), predecessor, resultData);
        } else {
            LOG.error("No predecessor data for {} {} {} {}", versionCurrent.getName(), predecessor, testclazz, testcase.getMethodWithParams());
        }
    } catch (final JAXBException e) {
        LOG.error("An exception occured during reading the measurement results");
        e.printStackTrace();
    }
}
Also used : TestData(de.dagere.peass.measurement.statistics.data.TestData) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) JAXBException(javax.xml.bind.JAXBException) XMLDataLoader(de.dagere.kopeme.datastorage.XMLDataLoader) Kopemedata(de.dagere.kopeme.generated.Kopemedata) File(java.io.File)

Example 24 with Kopemedata

use of de.dagere.kopeme.generated.Kopemedata in project peass by DaGeRe.

the class TestSummaryFileSaving method testSummaryFileSavingExternalFile.

@Test
public void testSummaryFileSavingExternalFile() throws JAXBException {
    DummyKoPeMeDataCreator.initDummyTestfile(testFolder, TestResult.BOUNDARY_SAVE_FILE * 2, testcase);
    final XMLDataLoader loader = new XMLDataLoader(oneResultFile);
    loader.readFulldataValues();
    Kopemedata oneRunFullData = loader.getFullData();
    TestcaseType oneRunData = oneRunFullData.getTestcases().getTestcase().get(0);
    final File resultFile = new File(testFolder, "result.xml");
    MultipleVMTestUtil.saveSummaryData(resultFile, oneResultFile, oneRunData.getDatacollector().get(0).getResult().get(0), testcase, "1", 0, TimeDataCollector.class.getName());
    Assert.assertTrue(resultFile.exists());
}
Also used : TimeDataCollector(de.dagere.kopeme.datacollection.TimeDataCollector) TestcaseType(de.dagere.kopeme.generated.TestcaseType) XMLDataLoader(de.dagere.kopeme.datastorage.XMLDataLoader) Kopemedata(de.dagere.kopeme.generated.Kopemedata) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 25 with Kopemedata

use of de.dagere.kopeme.generated.Kopemedata in project peass by DaGeRe.

the class TestResultConversion method testIterations.

@Test
public void testIterations() throws JAXBException {
    File jmhFile = new File(CONVERSION_FOLDER, "test.json");
    Set<File> resultFiles = convert(jmhFile);
    MatcherAssert.assertThat(resultFiles, Matchers.hasSize(1));
    File resultFile = resultFiles.iterator().next();
    Kopemedata data = XMLDataLoader.loadData(resultFile);
    List<Result> results = data.getTestcases().getTestcase().get(0).getDatacollector().get(0).getResult();
    MatcherAssert.assertThat(results, Matchers.hasSize(2));
    Result result = results.get(0);
    Assert.assertEquals(10, result.getIterations());
    Assert.assertEquals(0, result.getWarmup());
    System.out.println(result.getRepetitions());
}
Also used : Kopemedata(de.dagere.kopeme.generated.Kopemedata) File(java.io.File) Result(de.dagere.kopeme.generated.Result) Test(org.junit.jupiter.api.Test)

Aggregations

Kopemedata (de.dagere.kopeme.generated.Kopemedata)38 File (java.io.File)29 Result (de.dagere.kopeme.generated.Result)15 XMLDataLoader (de.dagere.kopeme.datastorage.XMLDataLoader)14 TestcaseType (de.dagere.kopeme.generated.TestcaseType)14 Test (org.junit.jupiter.api.Test)12 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)11 Datacollector (de.dagere.kopeme.generated.TestcaseType.Datacollector)10 Chunk (de.dagere.kopeme.generated.TestcaseType.Datacollector.Chunk)8 JAXBException (javax.xml.bind.JAXBException)6 Fulldata (de.dagere.kopeme.generated.Result.Fulldata)4 PeassFolders (de.dagere.peass.folders.PeassFolders)4 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)3 WildcardFileFilter (org.apache.commons.io.filefilter.WildcardFileFilter)3 DescriptiveStatistics (org.apache.commons.math3.stat.descriptive.DescriptiveStatistics)3 TimeDataCollector (de.dagere.kopeme.datacollection.TimeDataCollector)2 Testcases (de.dagere.kopeme.generated.Kopemedata.Testcases)2 JmhTestTransformer (de.dagere.peass.dependency.jmh.JmhTestTransformer)2 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)2 TestExecutor (de.dagere.peass.execution.utils.TestExecutor)2