use of de.dagere.peass.analysis.changes.ProjectChanges in project peass-ci-plugin by jenkinsci.
the class TestMeasureVersionAction method testIsChanged.
@Test
public void testIsChanged() {
final ProjectChanges changes = getChanges();
MeasureVersionAction action = new MeasureVersionAction(new MeasurementConfig(5), changes.getVersion("1"), new ProjectStatistics(), new HashMap<>(), new HashMap<>(), new HashMap<>());
Assert.assertTrue(action.testIsChanged("de.package.ClassA#method1"));
Assert.assertTrue(action.testIsChanged("de.package.ClassA#method2"));
Assert.assertTrue(action.testIsChanged("de.package.ClassB#method2"));
}
use of de.dagere.peass.analysis.changes.ProjectChanges in project peass-ci-plugin by jenkinsci.
the class TestRCAVisualizer method testHTMLGeneration.
@Test
public void testHTMLGeneration() throws Exception {
final File testChangeFile = new File("src/test/resources/demo-results/rca/changes.json");
ProjectChanges changes = Constants.OBJECTMAPPER.readValue(testChangeFile, ProjectChanges.class);
initFolders();
final File visualizationResultFolder = new File(folder.getRoot(), "visualization_result");
final Run run = mockRun(visualizationResultFolder);
// Calls the RCAVisualizer, which should be tested
MeasurementConfig measurementConfig = new MeasurementConfig(2);
measurementConfig.getExecutionConfig().setVersion("b02c92af73e3297be617f4c973a7a63fb603565b");
VisualizationFolderManager visualizationFolders = new VisualizationFolderManager(folder.getRoot(), "project", run);
RCAVisualizer visualizer = new RCAVisualizer(measurementConfig, visualizationFolders, changes, run);
visualizer.visualizeRCA();
testCorrectResult(run, visualizationResultFolder);
}
use of de.dagere.peass.analysis.changes.ProjectChanges in project peass-ci-plugin by jenkinsci.
the class TestRCAVisualizerPrefix method createChangefileActions.
private Run createChangefileActions(final File changefile) throws IOException, StreamReadException, DatabindException {
ProjectChanges changes = Constants.OBJECTMAPPER.readValue(changefile, ProjectChanges.class);
Changes versionChanges = changes.getVersionChanges().values().iterator().next();
String longestPrefix = RCAVisualizer.getLongestPrefix(versionChanges.getTestcaseChanges().keySet());
Run run = Mockito.mock(Run.class);
RCAVisualizer rcaVisualizer = new RCAVisualizer(null, null, null, run);
for (Entry<String, List<Change>> testcases : versionChanges.getTestcaseChanges().entrySet()) {
for (Change change : testcases.getValue()) {
final String name = testcases.getKey() + "_" + change.getMethod();
rcaVisualizer.createRCAAction(new File("target/"), longestPrefix, testcases, change, name, changefile);
}
}
return run;
}
use of de.dagere.peass.analysis.changes.ProjectChanges in project peass-ci-plugin by jenkinsci.
the class LocalPeassProcessManager method getChanges.
private ProjectChanges getChanges() throws IOException, JsonParseException, JsonMappingException {
final File changeFile = results.getChangeFile();
final ProjectChanges changes;
if (changeFile.exists()) {
changes = Constants.OBJECTMAPPER.readValue(changeFile, ProjectChanges.class);
} else {
changes = new ProjectChanges();
}
return changes;
}
use of de.dagere.peass.analysis.changes.ProjectChanges 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;
}
Aggregations