Search in sources :

Example 11 with ProjectChanges

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"));
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) Test(org.junit.Test)

Example 12 with ProjectChanges

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);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) RCAVisualizer(de.dagere.peass.ci.helper.RCAVisualizer) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) Run(hudson.model.Run) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) File(java.io.File) Test(org.junit.Test)

Example 13 with ProjectChanges

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;
}
Also used : Changes(de.dagere.peass.analysis.changes.Changes) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) RCAVisualizer(de.dagere.peass.ci.helper.RCAVisualizer) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) Run(hudson.model.Run) List(java.util.List) Change(de.dagere.peass.analysis.changes.Change) File(java.io.File)

Example 14 with ProjectChanges

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;
}
Also used : ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) File(java.io.File)

Example 15 with ProjectChanges

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;
}
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)

Aggregations

ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)23 File (java.io.File)14 Change (de.dagere.peass.analysis.changes.Change)7 VersionChangeProperties (de.dagere.peass.analysis.properties.VersionChangeProperties)6 Changes (de.dagere.peass.analysis.changes.Changes)5 Test (org.junit.Test)5 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)4 LinkedList (java.util.LinkedList)4 RepoFolders (de.dagere.peass.analysis.all.RepoFolders)3 ChangeReader (de.dagere.peass.analysis.changes.ChangeReader)3 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)3 MeasureVersionAction (de.dagere.peass.ci.MeasureVersionAction)3 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)3 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)3 ChangeProperties (de.dagere.peass.analysis.properties.ChangeProperties)2 ChangeProperty (de.dagere.peass.analysis.properties.ChangeProperty)2 HistogramValues (de.dagere.peass.ci.helper.HistogramValues)2 RCAVisualizer (de.dagere.peass.ci.helper.RCAVisualizer)2 StatisticsConfig (de.dagere.peass.config.StatisticsConfig)2 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)2