Search in sources :

Example 1 with VisualizationFolderManager

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

the class TestRTSLogFileReaderParameterized method testParameterizedReading.

@Test
public void testParameterizedReading() {
    VisualizationFolderManager visualizationFoldersMock = Mockito.mock(VisualizationFolderManager.class);
    Mockito.when(visualizationFoldersMock.getResultsFolders()).thenReturn(new ResultsFolders(currentDir, "parameterized-demo"));
    Mockito.when(visualizationFoldersMock.getPeassFolders()).thenReturn(new PeassFolders(new File(currentDir, "parameterized-demo_peass")));
    MeasurementConfig measurementConfig = Mockito.mock(MeasurementConfig.class);
    ExecutionConfig executionConfig = new ExecutionConfig();
    executionConfig.setVersion(VERSION);
    executionConfig.setVersionOld(VERSION_OLD);
    Mockito.when(measurementConfig.getExecutionConfig()).thenReturn(executionConfig);
    RTSLogFileReader reader = new RTSLogFileReader(visualizationFoldersMock, measurementConfig);
    Map<TestCase, RTSLogData> rtsVmRuns = reader.getRtsVmRuns(VERSION);
    RTSLogData data = rtsVmRuns.get(new TestCase("de.dagere.peass.ExampleTest", "test", "", "JUNIT_PARAMETERIZED-1"));
    Assert.assertNotNull(data);
    Assert.assertFalse(data.isParameterizedWithoutIndex());
    Assert.assertTrue(data.isSuccess());
    Map<TestCase, RTSLogData> rtsVmRunsPredecessor = reader.getRtsVmRuns(VERSION_OLD);
    RTSLogData dataImplicitParameterized = rtsVmRunsPredecessor.get(new TestCase("de.dagere.peass.ExampleTest", "test", ""));
    Assert.assertNotNull(dataImplicitParameterized);
    Assert.assertTrue(dataImplicitParameterized.isParameterizedWithoutIndex());
    Assert.assertFalse(dataImplicitParameterized.isSuccess());
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) RTSLogData(de.dagere.peass.ci.logs.rts.RTSLogData) RTSLogFileReader(de.dagere.peass.ci.logs.RTSLogFileReader) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 2 with VisualizationFolderManager

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

the class TestMeasurementVisualizer method testParameterizedVisualization.

@Test
public void testParameterizedVisualization() {
    HashSet<String> tests = new LinkedHashSet<>();
    tests.add("de.dagere.peass.ExampleTest#test(JUNIT_PARAMETERIZED-0)");
    tests.add("de.dagere.peass.ExampleTest#test(JUNIT_PARAMETERIZED-1)");
    File exampleDataFolder = new File("src/test/resources/demo-results-measurements/measurement_a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b_49f75e8877c2e9b7cf6b56087121a35fdd73ff8b/");
    Run run = Mockito.mock(Run.class);
    VisualizationFolderManager visualizationFolderManager = Mockito.mock(VisualizationFolderManager.class);
    DefaultMeasurementVisualizer visualizer = new DefaultMeasurementVisualizer(exampleDataFolder, "a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b", run, visualizationFolderManager, tests);
    visualizer.visualizeMeasurements();
    ArgumentCaptor<MeasurementVisualizationAction> captor = ArgumentCaptor.forClass(MeasurementVisualizationAction.class);
    Mockito.verify(run, Mockito.times(2)).addAction(captor.capture());
    MeasurementVisualizationAction action1 = captor.getAllValues().get(0);
    Assert.assertEquals(action1.getDisplayName(), "measurement_ExampleTest_test(JUNIT_PARAMETERIZED-0)");
    MeasurementVisualizationAction action2 = captor.getAllValues().get(1);
    Assert.assertEquals(action2.getDisplayName(), "measurement_ExampleTest_test(JUNIT_PARAMETERIZED-1)");
    Map<String, TestcaseStatistic> noWarmupStatistics = visualizer.getNoWarmupStatistics();
    Assert.assertTrue(noWarmupStatistics.containsKey("de.dagere.peass.ExampleTest#test(JUNIT_PARAMETERIZED-0)"));
    Assert.assertTrue(noWarmupStatistics.containsKey("de.dagere.peass.ExampleTest#test(JUNIT_PARAMETERIZED-1)"));
}
Also used : LinkedHashSet(java.util.LinkedHashSet) TestcaseStatistic(de.dagere.peass.measurement.statistics.data.TestcaseStatistic) DefaultMeasurementVisualizer(de.dagere.peass.ci.helper.DefaultMeasurementVisualizer) Run(hudson.model.Run) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) File(java.io.File) MeasurementVisualizationAction(de.dagere.peass.ci.MeasurementVisualizationAction) Test(org.junit.jupiter.api.Test)

Example 3 with VisualizationFolderManager

use of de.dagere.peass.ci.helper.VisualizationFolderManager 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 4 with VisualizationFolderManager

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

the class RTSLogFileTestUtil method initializeReader.

RTSLogFileReader initializeReader() {
    MeasurementConfig peassDemoConfig = new MeasurementConfig(2, VERSION, VERSION_OLD);
    VisualizationFolderManager visualizationFolders = Mockito.mock(VisualizationFolderManager.class);
    Mockito.when(visualizationFolders.getPeassFolders()).thenReturn(new PeassFolders(testFolder));
    Mockito.when(visualizationFolders.getResultsFolders()).thenReturn(new ResultsFolders(localFolder, projectName));
    RTSLogFileReader reader = new RTSLogFileReader(visualizationFolders, peassDemoConfig);
    return reader;
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) RTSLogFileReader(de.dagere.peass.ci.logs.RTSLogFileReader) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PeassFolders(de.dagere.peass.folders.PeassFolders)

Example 5 with VisualizationFolderManager

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

the class TestRCALogFileReaderMultimodule method testReading.

@Test
public void testReading() throws JsonParseException, JsonMappingException, IOException {
    MeasurementConfig peassDemoConfig = new MeasurementConfig(2, RTSLogFileTestUtil.VERSION, RTSLogFileTestUtil.VERSION_OLD);
    VisualizationFolderManager visualizationFolders = Mockito.mock(VisualizationFolderManager.class);
    Mockito.when(visualizationFolders.getPeassFolders()).thenReturn(new PeassFolders(testFolder));
    Mockito.when(visualizationFolders.getPeassRCAFolders()).thenReturn(new CauseSearchFolders(testFolder));
    Mockito.when(visualizationFolders.getResultsFolders()).thenReturn(new ResultsFolders(localFolder, "demo-vis2"));
    LogFileReader reader = new LogFileReader(visualizationFolders, peassDemoConfig);
    Map<TestCase, List<RCALevel>> rcaTestcases = reader.getRCATestcases();
    List<RCALevel> levels = rcaTestcases.get(test);
    Assert.assertEquals(1, levels.size());
    MatcherAssert.assertThat(levels.get(0).getLogFiles(), Matchers.hasSize(3));
    String rtsLog = reader.getRCALog();
    Assert.assertEquals("This is a rca log test", rtsLog);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) LogFileReader(de.dagere.peass.ci.logs.LogFileReader) List(java.util.List) VisualizationFolderManager(de.dagere.peass.ci.helper.VisualizationFolderManager) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PeassFolders(de.dagere.peass.folders.PeassFolders) RCALevel(de.dagere.peass.ci.logs.rca.RCALevel) Test(org.junit.jupiter.api.Test)

Aggregations

VisualizationFolderManager (de.dagere.peass.ci.helper.VisualizationFolderManager)8 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)7 PeassFolders (de.dagere.peass.folders.PeassFolders)6 ResultsFolders (de.dagere.peass.folders.ResultsFolders)6 Test (org.junit.jupiter.api.Test)6 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)5 File (java.io.File)5 LogFileReader (de.dagere.peass.ci.logs.LogFileReader)4 List (java.util.List)4 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)2 LogFiles (de.dagere.peass.ci.logs.LogFiles)2 RTSLogFileReader (de.dagere.peass.ci.logs.RTSLogFileReader)2 RCALevel (de.dagere.peass.ci.logs.rca.RCALevel)2 CauseSearchFolders (de.dagere.peass.folders.CauseSearchFolders)2 Run (hudson.model.Run)2 ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)1 MeasurementVisualizationAction (de.dagere.peass.ci.MeasurementVisualizationAction)1 DefaultMeasurementVisualizer (de.dagere.peass.ci.helper.DefaultMeasurementVisualizer)1 RCAVisualizer (de.dagere.peass.ci.helper.RCAVisualizer)1 RTSLogData (de.dagere.peass.ci.logs.rts.RTSLogData)1