use of de.dagere.peass.analysis.changes.Changes in project peass by DaGeRe.
the class ReadProperties method readChangeProperties.
public void readChangeProperties(final File changefile, final File projectFolder, final File viewFolder, final ExecutionData changedTests) throws IOException, JsonParseException, JsonMappingException, JsonGenerationException {
final File resultCSV = new File(out.getParentFile(), projectFolder.getName() + ".csv");
try (BufferedWriter csvWriter = new BufferedWriter(new FileWriter(resultCSV))) {
writeCSVHeadline(csvWriter);
final VersionChangeProperties versionProperties = new VersionChangeProperties();
final ProjectChanges changes = Constants.OBJECTMAPPER.readValue(changefile, ProjectChanges.class);
int versionCount = 0, testcaseCount = 0;
for (final Entry<String, Changes> versionChanges : changes.getVersionChanges().entrySet()) {
final String version = versionChanges.getKey();
final TestSet tests = changedTests.getVersions().get(version);
//
final String predecessor = tests != null ? tests.getPredecessor() : version + "~1";
testcaseCount += detectVersionProperty(projectFolder, viewFolder, csvWriter, versionProperties, versionChanges, predecessor, changedTests);
if (tests == null) {
LOG.error("Version not contained in runfile: " + version);
}
versionCount++;
}
// writeOnlySource(versionProperties, ProjectChanges.getOldChanges());
System.out.println("Analyzed: " + testcaseCount + " testcases in " + versionCount + " versions");
}
}
use of de.dagere.peass.analysis.changes.Changes in project peass by DaGeRe.
the class ReadProperties method readVersionProperties.
public static VersionChangeProperties readVersionProperties(final ProjectChanges knowledge, final File versionFile) {
final VersionChangeProperties versionProperties = new VersionChangeProperties();
try {
final VersionChangeProperties allProperties = Constants.OBJECTMAPPER.readValue(versionFile, VersionChangeProperties.class);
for (final Entry<String, Changes> versionChanges : knowledge.getVersionChanges().entrySet()) {
final String version = versionChanges.getKey();
final ChangeProperties allProps = allProperties.getVersions().get(version);
if (allProps != null) {
final ChangeProperties changeProperties = new ChangeProperties();
changeProperties.setCommitText(allProps.getCommitText());
changeProperties.setCommitter(allProps.getCommitText());
versionProperties.getVersions().put(version, changeProperties);
for (final Entry<String, List<Change>> changes : versionChanges.getValue().getTestcaseChanges().entrySet()) {
final String testclazz = changes.getKey();
final List<ChangeProperty> properties = new LinkedList<>();
final List<ChangeProperty> oldTestcaseProperties = allProps.getProperties().get(changes.getKey());
if (oldTestcaseProperties != null) {
changeProperties.getProperties().put(testclazz, properties);
for (final Change change : changes.getValue()) {
for (final ChangeProperty prop : oldTestcaseProperties) {
if (prop.getMethod().equals(change.getMethod())) {
properties.add(prop);
}
}
}
}
}
}
}
} catch (final IOException e) {
e.printStackTrace();
}
return versionProperties;
}
use of de.dagere.peass.analysis.changes.Changes 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.Changes 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.analysis.changes.Changes in project peass by DaGeRe.
the class ExperimentSelector method findMeasuredChange.
private Change findMeasuredChange(final ProjectChanges changes, final String version, final String testcase, final ChangeProperty change) {
Change statChange = null;
final Changes versionChanges = changes.getVersionChanges().get(version);
if (versionChanges != null) {
final List<Change> testcaseChanges = versionChanges.getTestcaseChanges().get(testcase);
if (testcaseChanges != null) {
statChange = findStatChange(change, testcaseChanges);
}
}
return statChange;
}
Aggregations