Search in sources :

Example 1 with LogFileReader

use of de.dagere.peass.ci.logs.LogFileReader 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)

Example 2 with LogFileReader

use of de.dagere.peass.ci.logs.LogFileReader in project peass-ci-plugin by jenkinsci.

the class TestLogFileReader method testReading.

@Test
public void testReading() throws JsonParseException, JsonMappingException, IOException {
    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, "demo-vis2"));
    LogFileReader reader = new LogFileReader(visualizationFolders, peassDemoConfig);
    ProjectStatistics statistics = Constants.OBJECTMAPPER.readValue(new File("src/test/resources/demo-results-logs/statistics.json"), ProjectStatistics.class);
    Map<TestCase, List<LogFiles>> testcases = reader.readAllTestcases(statistics.getStatistics().get(VERSION).keySet());
    Assert.assertEquals(1, testcases.size());
    TestCase test = new TestCase("de.test.CalleeTest#onlyCallMethod2");
    List<LogFiles> logFiles = testcases.get(test);
    Assert.assertEquals(2, logFiles.size());
    String measureLog = reader.getMeasureLog();
    Assert.assertEquals("This is a measurement log test", measureLog);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) LogFiles(de.dagere.peass.ci.logs.LogFiles) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) PeassFolders(de.dagere.peass.folders.PeassFolders) 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) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 3 with LogFileReader

use of de.dagere.peass.ci.logs.LogFileReader in project peass-ci-plugin by jenkinsci.

the class TestLogFileReader method testReadingIterationChanged.

@Test
public void testReadingIterationChanged() throws JsonParseException, JsonMappingException, IOException {
    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, "demo-vis2"));
    LogFileReader reader = new LogFileReader(visualizationFolders, peassDemoConfig);
    ProjectStatistics statistics = Constants.OBJECTMAPPER.readValue(new File("src/test/resources/demo-results-logs/statistics.json"), ProjectStatistics.class);
    Map<TestCase, List<LogFiles>> testcases = reader.readAllTestcases(statistics.getStatistics().get(VERSION).keySet());
    Assert.assertEquals(1, testcases.size());
    TestCase test = new TestCase("de.test.CalleeTest#onlyCallMethod2");
    List<LogFiles> logFiles = testcases.get(test);
    Assert.assertEquals(2, logFiles.size());
    Assert.assertFalse(logFiles.get(0).isCurrentSuccess());
    Assert.assertTrue(logFiles.get(0).isPredecessorSuccess());
    Assert.assertTrue(logFiles.get(1).isCurrentSuccess());
    Assert.assertTrue(logFiles.get(1).isPredecessorSuccess());
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) LogFileReader(de.dagere.peass.ci.logs.LogFileReader) LogFiles(de.dagere.peass.ci.logs.LogFiles) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) List(java.util.List) 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 4 with LogFileReader

use of de.dagere.peass.ci.logs.LogFileReader in project peass-ci-plugin by jenkinsci.

the class TestRCALogFileReader 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);
    TestCase test = new TestCase("de.test.CalleeTest#onlyCallMethod2");
    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)4 LogFileReader (de.dagere.peass.ci.logs.LogFileReader)4 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)4 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)4 PeassFolders (de.dagere.peass.folders.PeassFolders)4 ResultsFolders (de.dagere.peass.folders.ResultsFolders)4 List (java.util.List)4 Test (org.junit.jupiter.api.Test)4 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)2 LogFiles (de.dagere.peass.ci.logs.LogFiles)2 RCALevel (de.dagere.peass.ci.logs.rca.RCALevel)2 CauseSearchFolders (de.dagere.peass.folders.CauseSearchFolders)2 File (java.io.File)2