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"));
}
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());
}
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;
}
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());
}
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);
}
Aggregations