Search in sources :

Example 1 with HistogramValues

use of de.dagere.peass.ci.helper.HistogramValues in project peass-ci-plugin by jenkinsci.

the class TestMeasureVersionAction method testPrefix.

@Test
public void testPrefix() {
    final ProjectChanges changes = getChanges();
    HashMap<String, HistogramValues> measurements = new HashMap<String, HistogramValues>();
    measurements.put("de.package.ClassA#method1", null);
    measurements.put("de.package.ClassA#method2", null);
    measurements.put("de.package.ClassB#method2", null);
    measurements.put("de.package.otherpackage.ClassC#method2", null);
    MeasureVersionAction action = new MeasureVersionAction(new MeasurementConfig(5), changes.getVersion("1"), new ProjectStatistics(), new HashMap<>(), measurements, new HashMap<>());
    Assert.assertEquals("ClassA", action.getReducedName("de.package.ClassA"));
    Assert.assertEquals("otherpackage.ClassC", action.getReducedName("de.package.otherpackage.ClassC"));
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) HashMap(java.util.HashMap) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.Test)

Example 2 with HistogramValues

use of de.dagere.peass.ci.helper.HistogramValues in project peass-ci-plugin by jenkinsci.

the class TestHistogramReader method testHistogramCreation.

@Test
public void testHistogramCreation() throws JAXBException {
    MeasurementConfig measurementConfig = new MeasurementConfig(2);
    measurementConfig.getExecutionConfig().setVersion("b02c92af73e3297be617f4c973a7a63fb603565b");
    measurementConfig.getExecutionConfig().setVersionOld("e80d8a1bf747d1f70dc52260616b36cac9e44561");
    measurementConfig.setWarmup(2);
    measurementConfig.setIterations(2);
    measurementConfig.setRepetitions(2);
    HistogramReader reader = new HistogramReader(measurementConfig, new File(EXAMPLE_DATA_FOLDER, "b02c92af73e3297be617f4c973a7a63fb603565b"));
    Map<String, HistogramValues> measurements = reader.readMeasurements();
    double[] valuesBefore = measurements.get("de.test.CalleeTest#onlyCallMethod1").getValuesBefore();
    double[] valuesCurrent = measurements.get("de.test.CalleeTest#onlyCallMethod1").getValuesCurrent();
    MeasureVersionAction measureVersionActionMock = Mockito.mock(MeasureVersionAction.class);
    when(measureVersionActionMock.getValuesReadable(any(double[].class))).thenCallRealMethod();
    Assert.assertEquals(2, measureVersionActionMock.getValuesReadable(valuesBefore).split(",").length);
    Assert.assertEquals(2, measureVersionActionMock.getValuesReadable(valuesCurrent).split(",").length);
    Assert.assertFalse(reader.measurementConfigurationUpdated());
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.jupiter.api.Test)

Example 3 with HistogramValues

use of de.dagere.peass.ci.helper.HistogramValues in project peass-ci-plugin by jenkinsci.

the class LocalPeassProcessManager method visualizeMeasurementResults.

public ProjectChanges visualizeMeasurementResults(final Run<?, ?> run) throws JAXBException, IOException, JsonParseException, JsonMappingException, JsonGenerationException {
    File dataFolder = results.getVersionFullResultsFolder(peassConfig.getMeasurementConfig());
    final HistogramReader histogramReader = new HistogramReader(peassConfig.getMeasurementConfig(), dataFolder);
    final Map<String, HistogramValues> measurements = histogramReader.readMeasurements();
    final ProjectChanges changes = getChanges();
    final ProjectStatistics statistics = readStatistics();
    TrendFileUtil.persistTrend(run, localWorkspace, statistics);
    Map<String, TestcaseStatistic> noWarmupStatistics = createPureMeasurementVisualization(run, dataFolder, measurements);
    Changes versionChanges = changes.getVersion(peassConfig.getMeasurementConfig().getExecutionConfig().getVersion());
    final MeasureVersionAction action = new MeasureVersionAction(peassConfig.getMeasurementConfig(), versionChanges, statistics, noWarmupStatistics, measurements, histogramReader.getUpdatedConfigurations());
    run.addAction(action);
    return changes;
}
Also used : ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) Changes(de.dagere.peass.analysis.changes.Changes) TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues)

Example 4 with HistogramValues

use of de.dagere.peass.ci.helper.HistogramValues in project peass-ci-plugin by jenkinsci.

the class TestHistogramReader method testEmptyHistogram.

@Test
public void testEmptyHistogram() throws JAXBException {
    MeasurementConfig measurementConfig = new MeasurementConfig(2);
    measurementConfig.getExecutionConfig().setVersion("e80d8a1bf747d1f70dc52260616b36cac9e44561");
    measurementConfig.getExecutionConfig().setVersionOld("e80d8a1bf747d1f70dc52260616b36cac9e44561~1");
    HistogramReader reader = new HistogramReader(measurementConfig, new File(EXAMPLE_DATA_FOLDER, "e80d8a1bf747d1f70dc52260616b36cac9e44561"));
    Map<String, HistogramValues> measurements = reader.readMeasurements();
    Assert.assertNull(measurements.get("e80d8a1bf747d1f70dc52260616b36cac9e44561"));
    Assert.assertFalse(reader.measurementConfigurationUpdated());
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.jupiter.api.Test)

Example 5 with HistogramValues

use of de.dagere.peass.ci.helper.HistogramValues in project peass-ci-plugin by jenkinsci.

the class TestHistogramReader method testUpdatedConfiguration.

@Test
public void testUpdatedConfiguration() throws JAXBException {
    MeasurementConfig measurementConfig = new MeasurementConfig(2);
    measurementConfig.getExecutionConfig().setVersion("a23e385264c31def8dcda86c3cf64faa698c62d8");
    measurementConfig.getExecutionConfig().setVersionOld("33ce17c04b5218c25c40137d4d09f40fbb3e4f0f");
    HistogramReader reader = new HistogramReader(measurementConfig, new File(EXAMPLE_DATA_FOLDER, "measurement_a23e385264c31def8dcda86c3cf64faa698c62d8_33ce17c04b5218c25c40137d4d09f40fbb3e4f0f"));
    Map<String, HistogramValues> measurements = reader.readMeasurements();
    double[] valuesBefore = measurements.get("de.test.CalleeTest#onlyCallMethod2").getValuesBefore();
    double[] valuesCurrent = measurements.get("de.test.CalleeTest#onlyCallMethod2").getValuesCurrent();
    MeasureVersionAction measureVersionActionMock = Mockito.mock(MeasureVersionAction.class);
    when(measureVersionActionMock.getValuesReadable(any(double[].class))).thenCallRealMethod();
    Assert.assertEquals(measureVersionActionMock.getValuesReadable(valuesBefore).split(",").length, 2);
    Assert.assertEquals(measureVersionActionMock.getValuesReadable(valuesCurrent).split(",").length, 2);
    Assert.assertTrue(reader.measurementConfigurationUpdated());
    MeasurementConfig updatedConfig = reader.getUpdatedConfigurations().get("de.test.CalleeTest#onlyCallMethod2");
    Assert.assertEquals(updatedConfig.getIterations(), 2);
    Assert.assertEquals(updatedConfig.getRepetitions(), 200);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) HistogramReader(de.dagere.peass.ci.helper.HistogramReader) File(java.io.File) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.jupiter.api.Test)

Aggregations

HistogramValues (de.dagere.peass.ci.helper.HistogramValues)5 MeasureVersionAction (de.dagere.peass.ci.MeasureVersionAction)4 HistogramReader (de.dagere.peass.ci.helper.HistogramReader)4 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)4 File (java.io.File)4 Test (org.junit.jupiter.api.Test)3 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)2 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)2 Changes (de.dagere.peass.analysis.changes.Changes)1 TestcaseStatistic (de.dagere.peass.measurement.statistics.data.TestcaseStatistic)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1